PHP array_merge()

Jmnote (토론 | 기여)님의 2022년 4월 26일 (화) 20:59 판
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

1 개요[ | ]

PHP array_merge()
$array1 = ["color" => "red", 2, 4];
$array2 = ["a", "b", "color" => "green", "shape" => "trapezoid", 4];
$result = array_merge($array1, $array2);
print_r($result);
$array1 = [];
$array2 = [1 => "data"];
$result = array_merge($array1, $array2);
print_r($result);
$array1 = [0 => 'zero_a', 2 => 'two_a', 3 => 'three_a'];
$array2 = [1 => 'one_b', 3 => 'three_b', 4 => 'four_b'];
$result = $array1 + $array2;
var_dump($result);
$beginning = 'foo';
$end = [1 => 'bar'];
$result = array_merge((array)$beginning, (array)$end);
print_r($result);

2 같이 보기[ | ]

3 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}