language/types/string.xml
affa37e16f562d9297e83b2e21ec416aadc8b72d
...
...
@@ -866,9 +866,9 @@ echo "This works: {$arr['key']}";
866
866
echo "This works: {$arr[4][3]}";
867
867

868
868
// This is wrong for the same reason as $foo[bar] is wrong outside a string.
869
-
// In other words, it will still work, but only because PHP first looks for a
870
-
// constant named foo; an error of level E_NOTICE (undefined constant) will be
871
-
// thrown.
869
+
// PHP first looks for a constant named foo, and throws an error if not found.
870
+
// If the constant is found, its value (and not 'foo' itself) would be used
871
+
// for the array index.
872
872
echo "This is wrong: {$arr[foo][3]}";
873
873

874
874
// Works. When using multi-dimensional arrays, always use braces around arrays
875
875