The Recursive array_merge()¶
array_merge_recursive() merges several arrays together, like its cousin array_merge(). The important difference here is where the recursive applies.
The operation is recursive because the string keys will be merged together into an array, whenever the same key is found multiple times. A new array is created: scalar values are added to this array, and arrays are merged with it. Single keys are kept intact and integer keys are reindexed, starting at 0.
Note that to avoid the merge of sub-arrays, one need to put it inside yet another array (see array).