Thursday, May 24, 2007

PHP Fatal error: [] operator not supported for strings

PHP Fatal error: [] operator not supported for strings

PHP will throw up the error:

"Fatal error: [] operator not supported for strings"

if:

- The array variable eg, $foo[] has been set elsewhere as a string
- The array variable has already been set as an array elsewhere

The solution:

- Do not mix the same variable names between strings and arrays
- Do not create duplicate array names

No comments: