Trying to Separate data from this array here is the following code i am working on right now please help
$url=file_get_contents('https://corona-api.com/countries');
$data = json_decode($url);
here is the output in array which come after print_r the $data i tried some ways but did not understood the array sturcture
stdClass Object
(
[data] => Array
(
[0] => stdClass Object
(
[coordinates] => stdClass Object
(
[latitude] => 33
[longitude] => 65
)
[name] => Afghanistan
[code] => AF
[population] => 29121286
[updated_at] => 2020-03-28T06:54:16.562Z
[today] => stdClass Object
(
[deaths] => 0
[confirmed] => 0
)
[latest_data] => stdClass Object
(
[deaths] => 4
[confirmed] => 110
[recovered] => 2
[critical] => 0
[calculated] => stdClass Object
(
[death_rate] =>
[recovery_rate] =>
[recovered_vs_death_ratio] =>
[cases_per_million_population] => 3
)
)
)
[1] => stdClass Object
(
[coordinates] => stdClass Object
(
[latitude] => 41
[longitude] => 20
)
[name] => Albania
[code] => AL
[population] => 2986952
[updated_at] => 2020-03-28T06:54:16.562Z
[today] => stdClass Object
(
[deaths] => 0
[confirmed] => 0
)
[latest_data] => stdClass Object
(
[deaths] => 8
[confirmed] => 186
[recovered] => 31
[critical] => 3
[calculated] => stdClass Object
(
[death_rate] =>
[recovery_rate] =>
[recovered_vs_death_ratio] =>
[cases_per_million_population] => 65
)
)
)
i am trying to get country wise data but after getting this data in array i am having trouble to separate the data please help me