error message :Notice: Undefined offset: 7 in C:\xampp\htdocs\demo\forloopdemo.php on line 2
Answer this Question
You must be Logged In to post an Answer.
Not a member yet? Sign Up Now »
You must be Logged In to post an Answer.
Not a member yet? Sign Up Now »
Answer #1
The message says that there is no $company[7]. How should it have, since your array goes until $company[6]?
I believe that the problem must be in the use of double quotes which allow certain elements and variables to be parsed. In this case the number “4” in the first value and the “and” in the third value.
Myself, in this case, I would have enclosed all values in single quotes which display things as they are without parsing.
$foo = “bar”;
echo “$foo” will give us bar
echo ‘$foo’ will give us $foo