In PHP, the addition of arrays and Array_merge array merge is a little different, the following small part to give you students to introduce the difference between the Array_merge and the combination of arrays.
+ :
The first occurrence of the overlay will appear after the
Array_merge:
Will overwrite the previous occurrence. However, if it is a numeric index, it is an overlay effect.
The code is as follows |
Copy Code |
$array 1 = Array ( 0 = 111 ); $array 2 = Array ( 0 = 222, 1 = 3333 ); After Array_merge: Array ( [0] = 111 [1] = 222 [2] = 3333 ) + After: Array ( [0] = 111 [1] = 3333 ) Situation Two: $array 1 = Array ( 0 = 111 ); $array 2 = Array ( ' H ' = 222, 1 = 3333 ); The result of Array_merge and + is the same: Array ( [0] = 111 [H] = 222 [1] = 3333 ) |
The result is obvious:
Array_merge is the addition of two arrays, the key value if it is a number will be rearranged if not, it will not be modified
and + is two array addition will be the same key value of the value will be replaced by the previous array, if not the same key value and array_merge the same effect.
http://www.bkjia.com/PHPjc/628658.html www.bkjia.com true http://www.bkjia.com/PHPjc/628658.html techarticle in PHP, the addition of arrays and Array_merge array merge is a little different, the following small part to give you students to introduce the difference between the Array_merge and the combination of arrays. +: The first occurrence of the meeting ...