array_merge

array array_merge(mixed value_1, mixed value_2, [mixed ...]) 
value_1 Base array or value
value_2 Value or array to be merged with value_1
... Further values or arrays to be merged

Combines all given values into one array.

Returns:

Array containing the results of merging all passed values; NULL on failure

Description:

This function combines multiple values into a single array. Any number of values can be passed in the function call, including mixed arrays; any duplicate keys are overwritten by later elements in later arrays. Keys are merged in the order of the arrays that were passed.

Subarrays are not recursed over and are not altered; if you want to merge arrays recursively, use array_merge_recursive().

Scalar values can also ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.