There is a problem in the addition operation of PHParray. You can continue to look at it.
A problem in the addition operation of PHP array can be further viewed.
The + operator appends elements of remaining keys from the right handed array to the left handed, whereas duplicated keys are NOT overwritten.
I only know this when I read php manual again today.
The Code is as follows:
$ A = array ("a" => "apple", "B" => "banana ");
$ B = array ("a" => "pear", "B" => "strawberry", "c" => "cherry ");
$ C = $ a + $ B; // Union of $ a and $ B
Echo "Union of \ $ a and \ $ B: \ n ";
Var_dump ($ c );
$ C = $ B + $ a; // Union of $ B and $
Echo "Union of \ $ B and \ $ a: \ n ";
Var_dump ($ c );
?>
Bytes
When executed, this script will print the following:
Union of $ a and $ B:
The Code is as follows:
Array (3 ){
["A"] =>
String (5) "apple"
["B"] =>
String (6) "banana"
["C"] =>
String (6) "cherry"
}
Union of $ B and $:
Array (3 ){
["A"] =>
String (4) "pear"
["B"] =>
String (10) "strawberry"
["C"] =>
String (6) "cherry"
}
In the past, I understood the website space and the Hong Kong Space. Directly copy the elements in $ B to $.
I am wrong.
, Website Space