I am working on an assignment that displays the EU capitals for each country in bold. So far the code I am using matches with the exception that the data repeats 24-25 times. What am I missing?
[php]
EU Country ArrayCountries in the European Union and their Capitals
Sort by the name of the
Country
<?php$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”) ;
asort($EU) ;
foreach($EU as $country => $capital) {
echo “
- ”;
The capital of $k is $v
”;
foreach ($EU as $k => $v) {
echo “
}
echo “
}
?> [/php]