<? $array = array ( 'John' => 'Smith', 'John' => 'Adams', 'John' => 'Jones', 'John' => 'Doe', 'John' => 'Denver' ); ?>
how does one traverse this array? a foreach loop that echos keys => vales will only show the last index.
for ($i=0;$i<count($array);$i++) { echo $array[$i]; }
well,try it. In my opinion it might be of use.
That's because hashes don't support duplicate keys. The second 'John' will overwrite the first 'John', and the third 'John' will overwrite the second, ... and the last 'John' will overwrite the second last 'John'. That's why you only get the last 'John'.
Diego