This article mainly introduces the method of merging two arrays in php through the array_merge() function. An example analysis of php Friends who need tips on how to use the array_merge() function to merge arrays can refer to it
The example in this article describes how PHP merges two arrays through the array_merge() function. Share it with everyone for your reference. The specific analysis is as follows:
php merges two arrays through the array_merge() function. array_merge() is a php function that is used to merge two or more arrays. The latter array will be appended to the previous array and the result array will be returned. It accepts two or more arrays and returns an array containing all elements.
?
3 4
5
6
|
$first = array("aa", "bb", "cc"); $second = array(11,22,33); $third = array_merge($first, $second);
|
1 | The output is an array with ('aa', 'bb', 'cc', 11, 22, 33) |