Remove elements from an array and replace it with new elements in PHP
Description
The following code shows how to remove elements from an array and replace it with new elements.
Example
/*w w w . j a v a 2 s . com*/
<?php
$a1=array("a"=>"red","b"=>"green","c"=>"blue","d"=>"yellow");
$a2=array("a"=>"purple","b"=>"orange");
array_splice($a1,0,2,$a2);
print_r($a1);
?>
The code above generates the following result.