Code:
Copy code The code is as follows:
$a = array('a' => 'a', 'b' => 'b');
$b = array('c' => 'c', 'd' => 'd');
$c = $a + $b;
print('
'); print_r($c); print('
');
?>
Result:
Copy code The code is as follows:
Array
(
[a] => a
[b] => b
[c] => c
[d] => d
)
Note: There is still a difference between the plus sign and the array_merge() function, that is, when using the plus sign to merge arrays, if there are keys with the same name between the arrays, then the key values corresponding to the previous arrays will be retained. The array_merge() function is just the opposite.
The above has introduced a simple method of merging arrays in PHP using the plus sign in China Unicom 10010 Online Business Hall, including the content of China Unicom 10010 Online Business Hall. I hope it will be helpful to friends who are interested in PHP tutorials.