Onetastic Macro Documentation >
>
>
Array_Merge Array_Merge
Returns a new array that contains all the values in the given arrays. The values of each array are appended to the end of the previous one. If the arrays have the same string keys, then the later value for that key will overwrite the previous one. Numeric keys are not overwritten but instead will be appended. Values with numeric keys will be renumbered with incrementing keys starting from zero in the result array.
Syntax
Array Array_Merge(Array arrays...)
Parameters
- Array arrays (optional)
- Arrays to merge. No arrays or several arrays can be provided.
Examples
$array = Array_Merge()
$array = Array_Merge(Array(1, 2, 3), Array(7, 8, 9), Array(-2, -4, -5))
$array1["size"] = "large"
$array1["color"] = "red"
$array2["size"] = "small"
$array2["type"] = "t-shirt"
$array3["color"] = "blue"
$array3["price"] = 10
$array = Array_Merge($array1, $array2, $array3)
|