Null As Array Offset
Array indices may be integers or strings. They may also be boolean or null, although both these types are converted in integers and string (respectively).
In PHP 8.5, a warning is emitted when a null value is used as an index.
PHP code
<?php
$array = ['a' => 2];
$array[null] = 3;
print $array[''];
print $array[null];
?>
Before
33
After
PHP Deprecated: Using null as an array offset is deprecated, use an empty string instead
Deprecated: Using null as an array offset is deprecated, use an empty string instead
3PHP Deprecated: Using null as an array offset is deprecated, use an empty string instead
Deprecated: Using null as an array offset is deprecated, use an empty string instead
3
PHP version change
This behavior changed in 8.5.