It's to my understanding that the code below should produce a list of towns and their population.
When I run the php page all that is returned is a single town and it's population. Shouldn't the foreach walk trough the $town_population array beginning to end and list all of it's data? If you haven't guessed already, I’m new to the php.
Thanks to any and all for help.
Keyboardingly yours,
FSEdge
When I run the php page all that is returned is a single town and it's population. Shouldn't the foreach walk trough the $town_population array beginning to end and list all of it's data? If you haven't guessed already, I’m new to the php.
Code:
$town_population = array("Small Town" => 100,
"Medium Town" => 500,
"Large Town" => 1000,
"Mudville" => 1000000
);
ksort($town_population);
foreach($town_population as $town => $population);
{
$population = number_format($population);
echo "$town Population is: $population<br>";
}
Thanks to any and all for help.
Keyboardingly yours,
FSEdge