Remove elements from an array and replace it with new elements:


SUBMITTED BY: henry1874w

DATE: June 26, 2017, 4:41 p.m.

FORMAT: Text only

SIZE: 156 Bytes

HITS: 206

  1. <?php
  2. $a1=array("a"=>"red","b"=>"green","c"=>"blue","d"=>"yellow");
  3. $a2=array("a"=>"purple","b"=>"orange");
  4. array_splice($a1,0,2,$a2);
  5. print_r($a1);
  6. ?>

comments powered by Disqus