Skip to content

Latest commit

 

History

History
102 lines (88 loc) · 1.05 KB

array_merge.md

File metadata and controls

102 lines (88 loc) · 1.05 KB

array_merge

array_merge — Merge two arrays.

Description

array_merge(mixed $map_or_list, mixed $map_or_list_2) : array

Parameters

map_or_list

  • Initial (map or list) to merge.

map_or_list_2

  • (Map or list) to merge into initial (map or list).

Return Values

An array containing the result of two arrays merged.

Examples

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
)