go to bug id or search bugs for
From manual page: https://php.net/language.operators.array
It is only a problem in description.
In the docs, it states that $a + $b is Union and it is Union of $a and $b.
But it is not completely reflecting the characteristic of the Union in PHP.
Since strictly speaking, an Union should be mutually inclusive of different things.
In PHP, it is only an union of key regardless of value.
So it should be written as
Union of the key in $a and $b and based on $a or vice versa if it is $b + $a. (Because when there is/are key(s) exist(s) in the first variable, the same key(s) in the second variable will be ignored)
$a = array('something' => 'interesting', 2);
$b = array('another' => 'interesting thing', 0 => 3);
$c = $a + $b;
$d = $b + $a;
Add a Patch
Add a Pull Request
Isn't that already sufficiently explained:
| The + operator returns the right-hand array appended to the
| left-hand array; for keys that exist in both arrays, the elements
| from the left-hand array will be used, and the matching elements
| from the right-hand array will be ignored.
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.