Easy Tutorial
❮ Func Error Reporting Func Array Key Last ❯

PHP array_merge_recursive() Function

Complete PHP Array Reference Manual

Example

Merge two arrays into one:


Definition and Usage

The array_merge_recursive() function is used to merge one or more arrays into a single array.

The difference between this function and the array_merge() function is in how it handles cases where two or more array elements have the same key. array_merge_recursive() does not overwrite the keys; instead, it recursively combines the values of identical keys into an array.

Note: If you only pass one array to the array_merge_recursive() function, the result is the same as array_merge(), returning a new array with integer keys reindexed starting from 0.


Syntax

Parameter Description
array1 Required. Specifies the array.
array2 Optional. Specifies the array.
array3 Optional. Specifies the array.

Technical Details

Return Value: Returns the merged array.
PHP Version: 4.0.1+
--- ---
❮ Func Error Reporting Func Array Key Last ❯