array_merge — Merge two arrays.
array_merge(mixed $map_or_list, mixed $map_or_list_2) : array
map_or_list
- Initial (map or list) to merge.
map_or_list_2
- (Map or list) to merge into initial (map or list).
An array containing the result of two arrays merged.
Example #1 array_merge()
$map:(
color: red
);
$list:
(
1,
2,
5
);
$result: array_merge($map, $list);
Output:
(
color: red,
0: 1,
1: 2,
2: 5
)
Example #2 array_merge()
$list:
(
1,
2,
3
);
$list2:
(
4,
5,
6
);
$result: array_merge($list, $list2);
Output:
(
0: 1,
1: 2,
2: 3,
3: 4,
4: 5,
5: 6
)
Example #3 array_merge()
$map:
(
small: 1rem,
medium: 1.5rem,
large: 2rem
);
$map2:
(
medium: 2rem,
large: 3rem
);
$result: array_merge($map, $map2);
Output:
(
small: 1rem,
medium: 2rem,
large: 3rem
)