在php中访问数组数组中的数据

I've got an array that holds the results of a mysql query for zipcodes form a certain point around a given radius. If I var_dump the array it looks like this:

array(7) { 
[0]=> array(1) { ["postal_code"]=> string(5) "11510" }
[1]=> array(1) { ["postal_code"]=> string(5) "11518" } 
[2]=> array(1) { ["postal_code"]=> string(5) "11520" } 
[3]=> array(1) { ["postal_code"]=> string(5) "11558" }
[4]=> array(1) { ["postal_code"]=> string(5) "11563" } 
[5]=> array(1) { ["postal_code"]=> string(5) "11570" } 
[6]=> array(1) { ["postal_code"]=> string(5) "11572" } 
}

I'd like to extract the data and end up with a string of zipcodes with a comma as delimiter (i.e., "11510,11518,11520,11558,11563,11570,11572").

What would be the best way to do so?

Would something like this do what you want?

$postcodes = array();
foreach ($array as $postcodeData) {
    $postcodes[] = $postcodeData['postal_code'];
}

A foreach loop allows you to loop through the first level of the array, and then because the key is always the same you can just add the postcode to a new array.