The result of adding array ("a") + array ("B") to the php array is still array (""). I can see a question on the Internet: the result of array (A) + array (B) is ___. array (a, B) B. array (B, a) C. array (B) D. array (a) answer: Dphp adds two arrays. why is the result still not displayed on the Internet:
The result of array ("a") + array ("B") is ___
A. array ("a", "B ")
B. array ("B", "")
C. array ("B ")
D. array ("")
Answer: D
Why does the result remain unchanged when the php arrays are added?
Because they are equivalent to array ("0" => "a") + array ("0" => "B"), they have the same key name, the former cannot be overwritten by the latter. if it is array ("0" => "a") + array ("0" => "B ", "1" => "c"), then the result is equal to array ("0" => "a", "1" => "c ")
What happens if the same key name exists in the same array?
Read the code in the php official manual:
The code is as follows:
$ Switching = array (10, // key = 0
5 => 6,
3 => 7,
'A' => 4,
11, // key = 6 (maximum of integer-indices was 5)
'8' => 2, // key = 8 (integer !)
'02' => 77, // key = '02'
0 => 12 // the value 10 will be overwritten by 12
);
It can be seen that if the same key name exists in the same array, the value of the previous key name will be overwritten ).
The result of using array ("a") + array ("B") is ___. array ("a", "B") B. array ("B", "a") C. array ("B") D. array ("a") answer: D php adds two arrays, why is the result still not...