In php i have to print something that looks like The capitol of "" is "".
The challenge for me is that i am not receiving results when trying to sort the data using a while loop. I understand that my countries are the keys and the capitols are values in this example. so i used ksort as well as asort to get them both to return. I'm getting my echo statement but nothing from my $index or $EU statement. Just trying to see where i went wrong and suggestions on what i can do better? Thoughts? thanks
P.S i was thinking that i might need to use a foreach loop but honestly thought i could return the data using a while loop in the array.
<?
$EU = array("Italy"=>"Rome", "Luxembourg"=>"Luxembourg",
"Belgium"=> "Brussels", "Denmark"=>"Copenhagen",
"Finland"=>"Helsinki", "France" => "Paris",
"Slovakia"=>"Bratislava", "Slovenia"=>"Ljubljana",
"Germany" => "Berlin", "Greece" => "Athens",
"Ireland"=>"Dublin", "Netherlands"=>"Amsterdam",
"Portugal"=>"Lisbon", "Spain"=>"Madrid",
"Sweden"=>"Stockholm", "United Kingdom"=>"London",
"Cyprus"=>"Nicosia", "Lithuania"=>"Vilnius",
"Czech Republic"=>"Prague", "Estonia"=>"Tallin",
"Hungary"=>"Budapest", "Latvia"=>"Riga", "Malta"=>"Valetta",
"Austria" => "Vienna", "Poland"=>"Warsaw");
$index = 0;
ksort($EU);
asort($index);
While ($index <11)
{
echo " The Capitol of {$EU[$index]} is. <br/>";
$index++;
}
?>