When I execute this code I get NULL without any notice.
$a = false;
var_dump($a[5]);
Who can explain this?
When I execute this code I get NULL without any notice.
$a = false;
var_dump($a[5]);
Who can explain this?
Attempting to access an array key which has not been defined is the same as accessing any other undefined variable: an
E_NOTICE-level
error message will be issued, and the result will beNULL
.Array dereferencing a scalar value which is not a string silently yields
NULL
, i.e. without issuing an error message.
Please refer more details on this: http://php.net/manual/en/language.types.array.php