I have the following arrays
$country["china"] = array(
"shortcode" => "CN",
"president" => "Xi Jinping",
"currency" => "Yuan",
);
$country["america"] = array(
"shortcode" => "US",
"president" => "Barack Obama",
"currency" => "Dollar",
);
$country["russia"] = array(
"shortcode" => "RU",
"president" => "Vladimir Putin",
"currency" => "Rubble",
);
Now I'd like to extract the "president" value for each array above.
I tried this
foreach(array_keys($country) as $countryName => $countryvalue)
echo $countryvalue . "<br>";
I would like instead to get this output Xi Jinping Barack Obama Vladimir Putin
but instead I am getting a list of countries.
array_keysthen. Just aforeach($country as $countrydata) echo $countrydata['president'].