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