Defintion :
The array_merge_recursive()
function merge one or more arrays into one array recursively.
This function merges the elements of one or more arrays together in such a way that the values of one are appended to the end of the previous one. It returns a new array with merged elements.
Note: If you assign only one array to the array_merge_recursive() function, it will behave exactly the same as the array_merge() function.
array_merge_recursive(array1, array2, array3, ...)
Parameter | Description |
---|---|
array1 | Required. Specifies an array |
array2 | Optional. Specifies an array |
array3,... | Optional. Specifies an array |
The following example shows the array_merge_recursive()
function in action.
Output :
Array
(
[a] => Web
[b] => Array
(
[0] => Desinging
[1] => House
)
[c] => Online
)