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

(새 문서: ==개요== <source lang='PHP'> $base = array("orange", "banana", "apple", "raspberry"); $replacements = array(0 => "pineapple", 4 => "cherry"); $replacements2 = array(0 => "grape");...)
 
1번째 줄: 1번째 줄:
==개요==
==개요==
;PHP array_replace()
<source lang='PHP'>
<source lang='PHP'>
$base = array("orange", "banana", "apple", "raspberry");
$base = array("orange", "banana", "apple", "raspberry");

2016년 2월 1일 (월) 13:03 판

1 개요

PHP array_replace()
$base = array("orange", "banana", "apple", "raspberry");
$replacements = array(0 => "pineapple", 4 => "cherry");
$replacements2 = array(0 => "grape");

$basket = array_replace($base, $replacements, $replacements2);
print_r($basket);
# Array
# (
#     [0] => grape
#     [1] => banana
#     [2] => apple
#     [3] => raspberry
#     [4] => cherry
# )
$base = array("orange", "banana", "apple", "raspberry");
$replacements = array(0 => "pineapple", 5 => "cherry");
$basket = array_replace($base, $replacements);
print_r($basket);
# Array
# (
#     [0] => pineapple
#     [1] => banana
#     [2] => apple
#     [3] => raspberry
#     [5] => cherry
# )

2 같이 보기

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