[]
to read from an array PHP-W1002Trying to access an offset without providing a dimension is not allowed. This will emit a fatal error during runtime.
Unlike assignment, an offset without a dimension doesn't work implicitly in array access expressions. Always specify a dimension when accessing an array offset. Not doing so will result in a runtime error, and may even crash the application.
$array = [];
$array[] = 10;
$array[][] = 10;
echo $array[1][]; // invalid: empty dimension when reading the value
$array = [];
$array[] = 10;
$array[][] = 10;
echo $array[1][0]; // valid: will echo 10