Supposing I have this array:
Array
(
[NorthAmerica] => Array
(
[0] => Array
(
[country] => Canada
[capital] => Ottawa
)
[1] => Array
(
[country] => USA
[capital] => Washington
)
)
)
How can I loop into it to get NorthAmerica and capital ?
What I tried:
foreach($newDatas as $parent => $value) {
echo $value; // should return NorthAmerica
foreach($parent as $values) {
echo $values['capital']; // should return Ottawa
}
}
But it doesn't work.
Thanks for your help.