数组 - 如何检索值

时间:2015-12-18 03:27:07

标签: php arrays

示例1:

$string = stdClass Object ( [product_id] => 25 )
$result= $string->product_id

$ result将获得25

示例2:

$string = Array ( [30] => stdClass Object ( [product_id] => 44 ))
$result= $string[30]->product_id

$ result将获得44

这个怎么样?我想检索名字。

$string = [addresses] => Array ( [shipping] => 

AddressesAddress Object ( 
       [addressBook:AddressesAddress:private] => AddressesAddressBook  Object ( 
          [performanceHint:AddressesAddressBook:private] => 1 
          [uid:AddressesAddressBook:private] => 1
          [addresses:AddressesAddressBook:private] => Array ( 
             [-1] => AddressesAddress Object *RECURSION* 
             [-8] => AddressesAddress Object ( 
                 [addressBook:AddressesAddress:private] => AddressesAddressBook               Object *RECURSION* 
                [schemaAddress:AddressesSchemaAddress:private] => stdClass Object ( 
                [first_name] => Sir))))

我只知道这个:

$result= $string["shipping"]

,结果是

AddressesAddress Object ( 
   [addressBook:AddressesAddress:private] => AddressesAddressBook  Object ( 
      [performanceHint:AddressesAddressBook:private] => 1 
      [uid:AddressesAddressBook:private] => 1
      [addresses:AddressesAddressBook:private] => Array ( 
         [-1] => AddressesAddress Object *RECURSION* 
         [-8] => AddressesAddress Object ( 
             [addressBook:AddressesAddress:private] => AddressesAddressBook               Object *RECURSION* 
            [schemaAddress:AddressesSchemaAddress:private] => stdClass Object ( 
            [first_name] => Sir))))

我需要帮助。

0 个答案:

没有答案