PHP array replace()

1 개요[ | ]

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

$basket = array_replace($base, $replacements, $replacements2);
print_r($basket);
Loading
PHP
Copy
$base = ["orange", "banana", "apple", "raspberry"];
$replacements = [0 => "pineapple", 5 => "cherry"];
$basket = array_replace($base, $replacements);
print_r($basket);
Loading

2 같이 보기[ | ]