I've querying an API and I've got some troubles to display the code returned (JSON). If I do a var_dump, I have something like this:
var_dump($street['location']);
array(3) {
["latitude"]=> string(10) "52.6397278"
["street"]=> array(2) {
["id"]=> int(469)
["name"]=> string(23) "On or near Abbey Street"
}
["longitude"]=> string(10) "-1.1322920"
}
Now, usually, I will do something like that to have it displayed:
var_dump($street['location']);
echo '->latitude:' . $location['latitude'] . '<br/>';
foreach($location['street'] as $st){
echo '-->street id:' . $st['id'] . '<br/>';
echo '-->street name:' . $st['name'] . '<br/>';
}
echo '->Longitude:' . $location['longitude'] . '<br/>';
But I get:
array(3) {
["latitude"]=> string(10) "52.6397278"
["street"]=> array(2) {
["id"]=> int(469)
["name"]=> string(23) "On or near Abbey Street"
}
["longitude"]=> string(10) "-1.1322920"
} ->latitude:5
Warning: Invalid argument supplied for foreach() in /home/pasd529/public_html/npia.php on line 102
->Longitude:5
The latitude / longitude are truncated and I can't get the streed id / name ...
Thanks for your help