I have this array:
Array ( [location] => Array ( [country] => India [coun开发者_运维技巧try_code] => IN [region] => [region_code] => [city] => [zip] => [latitude] => 13.044468 [longitude] => 77.575665 [ip_address] => 123.236.219.154 [timestamp] => 1317496122 [route] => 3rd Cross Rd [neighborhood] => Basaveshwara Layout [sublocality] => BCITS PVT LTD [locality] => Bengaluru [administrative_area_level_2] => Bengaluru Rural [administrative_area_level_1] => Karnataka ) )
I wonder if there is a way that I can format it some what like this:
country: India
country_code:In
That is like
Key : Value
,
Key : Value
,
Key : Value
Something like that?
foreach( $array as $key => $value ) {
echo $key." : ".$value.",";
}
You have to check the last value and remove the "," then.
精彩评论