error message :Notice: Undefined offset: 7 in C:\xampp\htdocs\demo\forloopdemo.php on line 2
In: PHP Asked By: Bogdan_o31 [3 ] Tags: notice:Undefined offset, php
Answer this Question
You must be Logged In to post an Answer.
Not a member yet? Sign Up Now »
The message says that there is no $company. How should it have, since your array goes until $company?
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