is there any array replace function in php ..
in php manual there is a function called array_replace but its not working…
Tell me some example…
for array replace..
Advertisement
Answer
JavaScript
x
<?php
$base = array("orange", "banana", "apple", "raspberry");
$replacements = array(0 => "pineapple", 4 => "cherry");
$replacements2 = array(0 => "grape");
$basket = array_replace($base, $replacements, $replacements2);
echo '<pre>' .
print_r($base, true) .
print_r($basket, true) .
'</pre>';
output
JavaScript
Array
(
[0] => orange
[1] => banana
[2] => apple
[3] => raspberry
)
Array
(
[0] => grape
[1] => banana
[2] => apple
[3] => raspberry
[4] => cherry
)
the question is: what exactly isnt working for you?