diff --git a/language/types.xml b/language/types.xml index 9ea4cb9c1e..36a40ba712 100644 --- a/language/types.xml +++ b/language/types.xml @@ -1,5 +1,5 @@ - + Types @@ -1204,7 +1204,9 @@ unset( $a[2] ); Why is <literal>$foo[bar]</literal> wrong? - You might have seen the following syntax in old scripts: + You should always use quotes around an associative array index. + For example, use $foo['bar'] and not $foo[bar]. But why is $foo[bar] + wrong? You might have seen the following syntax in old scripts: - This is wrong, but it works. Then, why is it wrong? The reason is - that, as stated in the + + As stated in the syntax section, there must be an expression between the square brackets ('[' and ']'). That means that you can write things like this: