更改多维数组输出

时间:2016-04-09 17:39:57

标签: php arrays arraylist multidimensional-array output

我有一个变量$array,其中包含一系列数据zip_codedistancecitystate。我想要一个只有zip_code的数组。如果我print_r ($array);,我会得到以下内容。

Array ( [zip_codes] => Array ( [0] => Array ( [zip_code] => 02822 [distance] => 19.544 [city] => Exeter [state] => RI ) [1] => Array ( [zip_code] => 02871 [distance] => 18.965 [city] => Portsmouth [state] => RI ) [2] => Array ( [zip_code] => 02852 [distance] => 16.092 [city] => North Kingstown [state] => RI )

如何打印或将其打印成以下格式:

Array ( [0] => 02822 [1] => 02871 [2] => 02852 )

请帮忙。谢谢!

0 个答案:

没有答案