Here is my json string:
{
"routes": [
{
"bounds": {
"northeast": {
"lat": 41.9291739,
"lng": 23.7293099
},
"southwest": {
"lat": 37.9103506,
"lng": 12.4822041
}
},
"copyrights": "Map data,google",
"legs": [
{
"distance": {
"text": "1,250 km",
"value": 1249958
}
}
]
}
]
}
i want to get routes->legs->distance->value im using this code unsuccessfully:
$json = json_decode(file_get_contents('./test.txt'));
$distance = $json->routes[0]->legs[0]->distance->value;
var_dump($distance);
any ideas?