diff --git a/language/operators.xml b/language/operators.xml index 3a624f0e31..e963af2dd0 100644 --- a/language/operators.xml +++ b/language/operators.xml @@ -1,5 +1,5 @@ - + Operators @@ -643,7 +643,42 @@ $a .= "World!"; // now $a contains "Hello World!" + + + Array Operators + + The only array operator in PHP is the + operator. + It appends the right handed array to the left handed, whereas + duplicated keys are NOT overwritten. + + + + + "apple", "b" => "banana"); +$b = array("a" =>"pear", "b" => "strawberry", "c" => "cherry"); +$c = $a + $b; + +var_dump($c); +]]> + + + + string(5) "apple" + ["b"]=> + string(6) "banana" + ["c"]=> + string(6) "cherry" +} + +]]> + + + + + @@ -98,6 +98,11 @@ Array + + + Shared keys will be overwritten on a first-come first-served basis. + + See also array_merge_recursive.