I'm pretty sure that an error reporting set to E_NOTICE would cause a notice to be thrown - I might be wrong though. Edit: I can confirm that this does NOT throw a notice. Even just $foo['bar'] = true; var_dump($foo); seem to work.
Check this part of the PHP manual - It's working as designed. If $arr doesn't exist yet, it will be created, so this is also an alternative way to create an array. This practice is however discouraged because if $arr already contains some value (e.g. string from request variable) then this value will stay in the place and [] may actually stand for string access operator. It is always better to initialize variable by a direct assignment.
$foo['bar'] = true; var_dump($foo);seem to work.If $arr doesn't exist yet, it will be created, so this is also an alternative way to create an array. This practice is however discouraged because if $arr already contains some value (e.g. string from request variable) then this value will stay in the place and [] may actually stand for string access operator. It is always better to initialize variable by a direct assignment.