string indexed array looping problem
Posted: Mon Sep 14, 2009 3:53 am
Go through the following code..
It should print entire string indexed array. But why does it print the following ???
Code: Select all
<?php
/*function println($s) {
echo "$s<BR>\n";
}*/
$countries = array ( "ca" => "Canada",
"cr" => "Costa Rica",
"de" => "Germany",
"uk" => "United Kingdom",
"us" => "United States"
);
while(list($key,$val) = each($countries)) {
echo "Element $key equals $val<BR>\n");
}
?>Code: Select all
3<BR>
2<BR>
0<BR>
9<BR>
4<BR>
6<BR>