"PHP array merge()"의 두 판 사이의 차이

잔글 (Jmnote님이 PHP array merge 문서를 PHP array merge() 문서로 이동했습니다)
 
37번째 줄: 37번째 줄:
* https://www.php.net/manual/en/function.array-merge.php
* https://www.php.net/manual/en/function.array-merge.php


[[분류: PHP 배열]]
[[분류: PHP 배열 함수]]

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 }}