With both string and integer keys:


SUBMITTED BY: henry1874w

DATE: June 25, 2017, 2:53 p.m.

FORMAT: Text only

SIZE: 223 Bytes

HITS: 1090

  1. <?php
  2. $a=array("a"=>"red","b"=>"green","c"=>"blue","d"=>"yellow","e"=>"brown");
  3. print_r(array_slice($a,1,2));
  4. $a=array("0"=>"red","1"=>"green","2"=>"blue","3"=>"yellow","4"=>"brown");
  5. print_r(array_slice($a,1,2));
  6. ?>

comments powered by Disqus