0

如何从以下多维数组中获取数组中的所有“名称”和“城市”值?

$myarray=Array(Array('name' => 'A','id' => '1', 'phone' => '416-23-55',
Base => Array ('city'  => 'toronto'),'EBase' => Array('city' => 'North York'),
'Qty' => '1'),  (Array('name' =>'B','id' => '1','phone' => '416-53-66','Base' => 
Array  ('city' => 'qing'), 'EBase' => Array('city' => 'chong'),'Qty' => '2')));

我希望返回的值是

$namearray=Array('A','B');
$basecityarray=Array('toronto','qing');
$Ebasecityarray=Array('North York','chong');

谢谢!

4

1 回答 1

0

你绝对可以尝试这样的事情:

$shop = array( array( 'Title' => "rose", 
                  'Price' => 1.25,
                  'Number' => 15 
                ),
           array( 'Title' => "daisy", 
                  'Price' => 0.75,
                  'Number' => 25,
                ),
           array( 'Title' => "orchid", 
                  'Price' => 1.15,
                  'Number' => 7 
                )
         );

您可以访问第一行

echo $shop[0][0]." costs ".$shop[0][1]." and you get ".$shop[0][2]."<br />";

或者$shop[0]->Title会回报给你rose

于 2012-07-03T00:00:18.607 回答