PHP array_merge() Function is used to merge one or more arrays into one array. PHP array_merge() function is PHP built-in function.
array_merge(array $array1, array $array2, array $array3, ...);
$array1 : Required. It specifies array.
$array2 : Required. It specifies array.
$array3, ... : Required. It specifies array.
Return : It returns merged array by joining arrays together as per as below.
It merges the elements of one or more arrays together so that the values of one are appended to the end of the previous one.
If the parameter arrays have the same string keys, then the later value for that key will overwrite the previous one.
If you assign only one array to the array_merge() function and the keys are integers, then the function returns a new array with integer keys starting at 0 and increases by 1 for each value.
Let's see below example to understand php array_merge() Function in details.