我有一个变量$array
,其中包含一系列数据zip_code
,distance
,city
和state
。我想要一个只有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 )
请帮忙。谢谢!