<?php
$luckyNumbers = array (4,5,6,1,2,34);
for($i=0; $i <= count($luckyNumbers); $i++){
echo "$luckyNumbers[$i] <br>";
}
?>
I was trying to output
4
5
6
1
2
34
But the warning below is appearing - I just use the asterisk to cover folder name.
Warning: Undefined array key 6 in C:\Users******\php project\index.php on line 315
So the output becomes like this.
4
5
6
1
2
34
Warning: Undefined array key 6 in C:\Users\******\php project\index.php on line 315
Why is the error appearing when the output is right?