Using a negative start parameter:


SUBMITTED BY: henry1874w

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

FORMAT: Text only

SIZE: 91 Bytes

HITS: 978

  1. <?php
  2. $a=array("red","green","blue","yellow","brown");
  3. print_r(array_slice($a,-2,1));
  4. ?>

comments powered by Disqus