Friends, help with the code. I have json data, i want to display value "price". I can't figure out how to do this.
{
"success":true,
"data":{
"DXB":{
"0":{
"price":33915,
"airline":"DP",
"flight_number":991,
"departure_at":"2023-03-30T08:00:00+03:00",
"return_at":"2023-04-20T15:20:00+04:00",
"expires_at":"2023-03-28T04:45:51Z"
},
"1":{
"price":31997,
"airline":"J2",
"flight_number":182,
"departure_at":"2024-01-03T12:20:00+03:00",
"return_at":"2024-01-12T14:10:00+04:00",
"expires_at":"2023-03-28T04:45:51Z"
},
"2":{
"price":34593,
"airline":"DP",
"flight_number":423,
"departure_at":"2023-04-02T08:00:00+03:00",
"return_at":"2023-04-22T17:00:00+04:00",
"expires_at":"2023-03-28T04:45:51Z"
}
}
},
"currency":"rub"
}
<?php
$get_data = file_get_contents('ai url');
$get_data = json_decode($get_data);
?>
<?php foreach($get_data as $g): ?>
<h5><?php echo $g->price;?></h5>
<?php endforeach ?>
I tried the code that attached the gist, it returns null.
Tell me how to display data in sublevel json