Illegal string offset when printing array values in PHP -
Many similar problems and solutions did not help me. I'm getting a strange error message WARNING: Invalid string offset in 'officeName' ... and var_dump of variable variable generates looks like this:
Array (10) {[officeId "] => string (5)" 11237 "[" officeName "] => string (37)" Pro Office Inc. "} The code that generates errors is:
foreach ($ objects $ key => $ value) {var_dump ($ value);} Then $ value is an array what I am doing and how can I fix it, its What is wrong with?
each , because one of these items There may be an array, but there can be something that is not. In such cases, it is always better than var_dump () whole $ objects array instead of each item , Because it is easy to find any errors.
In addition, invalid string offset error usually indicates that Ing do are trying to behave as an array and / or use of the keys, which are not present.
Comments
Post a Comment