array_replace
Replaces elements from passed arrays into the first array
&reftitle.description;
arrayarray_replace
arrayarray
arrayarray1
arrayarray2
array...
array_replace replaces the values of the first
array with the same values from all the following
arrays. If a key from the first array exists in the second array, its value
will be replace by the value from the second array. If the key exists in the
second array, and not the first, it will be created in the first array.
If a key only exists in the first array, it will be left as is.
If several array are passed for replacement, they will be processed
in order, the former array overwritting the previous values.
array_replace is not recursive : it will replace
values in the first array by whatever type is in the second array.
&reftitle.parameters;
array
The array in which elements are replace.
array1
The array from which elements will be extracted.
&reftitle.returnvalues;
Returns an &array;, or &null; if an error occurs.
&reftitle.examples;
array_replace example
"pineapple", 4 => "cherry");
$replacements2 = array(0 => "grape");
$basket = array_replace($base, $replacements, $replacements2);
print_r($basket);
?>
]]>
&example.outputs;
grape
[1] => banana
[2] => apple
[3] => raspberry
[4] => cherry
)
]]>
&reftitle.seealso;
array_replace_recursive