Using null as an array offset is deprecated, use an empty string instead
Description
Avoid using null as an array index. PHP converts it silently to an empty string anyway.
Example
<?php
$array = ['a' => 2];
$array[null] = 3;
?>
Alternatives
- Replace the
nullwith an empty string. - Check the value before using it as an array index.
Related error messages
Changed Behavior
This error may appear following an evolution in behavior, in previous versions. See NullAsArrayOffset