如何获取数组的值?

时间:2010-10-21 09:36:03

标签: php arrays loops

我想在此数组中获取productId和addressTypeID的值: 排列 (

[0] => Array
    (
        [entityId] => 7100122
        [orderId] => 110631
        [createDate] => 2010-10-19T05:40:00
        [lastUpdateDate] => 2010-10-19T05:40:00
        [deleted] => 
        [products] => Array
            (
                [Product] => Array
                    (
                        [productId] => 674976
                        [productCode] => 
                        [productDescription] => testtest
                        [units] => 3
                    )

            )

        [addresses] => Array
            (
                [Address] => Array
                    (
                        [addressTypeID] => 8
                        [addressLine1] => Cebu, Ceity
                        [city] => City
                        [zipcode] => 6000
                        [state] => cebu
                        [countryCode] => PH
                    )

            )

    )

我如何获得它的价值?

2 个答案:

答案 0 :(得分:3)

像:

$myarray[0]['products']['Product']['productId']

$myarray[0]['addresses']['Address']['addressTypeID']

了解更多信息

http://php.net/manual/en/language.types.array.php

答案 1 :(得分:1)

$product_id = $your_array['products']['Product']['productId'];

$address_id = $your_array['addresses']['Address']['addressTypeID'];
相关问题