Null Used As Array¶
Null is not an array, but it is possible to use the array syntax with it. The values are then always null, and since PHP 7.4, a warning is emitted.
PHP code¶
<?php
var_dump(null[0]);
var_dump(null['dsds']);
?>
Before¶
NULL
After¶
PHP Warning: Trying to access array offset on null
Warning: Trying to access array offset on null
NULL
PHP version change¶
This behavior changed in 7.4