Forum Moderators: coopster
$miles_zip = array();
foreach ($subzip as $key => $value) { //3
$miles = $z->get_distance( $zipCode, $key);
$miles_zip[$i] = $miles ;
$i++;
} //3$count = count($miles_zip) ;
for ($i = 0; $i < $count; $i++)
echo " $miles_zip[$i]<br> ";
I am trying to put $key and $miles in a multi dimensional array. I have tried different ways, it is not working.
All I see online is syntax of creating static multidimensional arrays. Can somebody guide me how can I create a dynamic one.
I am trying to retrieve zipcodes from nearest to farthest. The
distance is not in the database.
$miles_zip = array();
foreach ($zips as $key => $value) { //3
$miles = $z->get_distance( $zipCode, $key);
$miles_zip[$key] = $miles ;
} //3
foreach ($miles_zip as $key=>$zipcodes) {
echo "$key $zipcodes <br>" ;
}
Atleast this way it is showing me the values
I'm trying to think if you can use array_map instead, but I guess it doesn't really matter. If it works effectively that's good enough! hehe