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