I am using PHP 7.2. I come across the following note from the arrays chapter of PHP Manual
Array dereferencing a scalar value which is not a string s
They are referring to non-complex types such as int or float.
In your example you are using an array. So you don't see the issue.
The first pair of brackets is array-dereferencing on the array (1, 2222, 3), the second is array-dereferencing on an integer (2222) which always returns null.
Simplified:
This "fails silently" as in theory you should get an error from this, rather than just null.
Also happens with null, other than int, float, bool:
But works correctly instead with arrays and strings.
Answering your question, "How does the “Array dereferencing” work on a scalar value of type": It doesn't, it just returns null instead of returning an error of some sort.