$nama = array('a' => 'John', 'b' => 'James', 'c' => 'Ray', 'd' => 'Lime', 'e' => 'Kit');
//sort ($nama);
//reset($nama);
$i=1;
do
{
echo "The key is " .$i. " and the value is " .$nama[$i];
$i++;
}
while ($i<=5);
Echo "newline";
?>
The following error appears:
Notice: Undefined offset: 1 in C:\xampp\htdocs\php_exercise\exercise3.php on line 12
The key is 1 and the value is
Notice: Undefined offset: 2 in C:\xampp\htdocs\php_exercise\exercise3.php on line 12
The key is 2 and the value is
Notice: Undefined offset: 3 in C:\xampp\htdocs\php_exercise\exercise3.php on line 12
The key is 3 and the value is
Notice: Undefined offset: 4 in C:\xampp\htdocs\php_exercise\exercise3.php on line 12
The key is 4 and the value is
Notice: Undefined offset: 5 in C:\xampp\htdocs\php_exercise\exercise3.php on line 12
The key is 5 and the value is newline
Any clue? Thanks.