Your code is sloppy, lines 4, 6 and 7 are not terminated with a semi-colon. Line 4 is missing array . Line 13 has a wrong double quote.
pritaeas
Posting Expert
5,480 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
Yes, the keys are not 1 to 5, but a to e.
<?php
$nama = array('a' => 'John', 'b' => 'James', 'c' => 'Ray', 'd' => 'Lime', 'e' => 'Kit');
//sort ($nama);
//reset($nama);
foreach ($nama as $key => $value)
{
echo 'The key is ' . $key . ' and the value is ' . $value . '<br/>\n';
}
?>
pritaeas
Posting Expert
5,480 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875