Current Location: Home> Function Categories> array_merge

array_merge

Merge one or more arrays
Name:array_merge
Category:Array
Programming Language:php
One-line Description:Combine one or more arrays into one.

Definition and usage

array_merge() function combines one or more arrays into an array.

Tip: You can enter one or more arrays into the function.

Note: If two or more array elements have the same key name, the last element overwrites the other elements.

Note: If you enter only an array to array_merge() function and the key name is an integer, the function returns a new array with integer key names, whose key name begins with 0 (see Example 1 below).

Tip: The difference between this function and the array_merge_recursive() function is to deal with the situation where two or more array elements have the same key name. array_merge_recursive() does not overwrite key names, but recursively combines multiple values ​​of the same key names into an array.

grammar

 array_merge ( array1 , array2 , array3 ... )
parameter describe
array1 Required. Specify array.
array2 Optional. Specify array.
array3 Optional. Specify array.
Similar Functions
Popular Articles