PHP: Remove the first and last item of the array

Posted by phpBOY on Stack Overflow See other posts from Stack Overflow or by phpBOY
Published on 2010-04-20T13:03:28Z Indexed on 2010/04/20 13:13 UTC
Read the original article Hit count: 156

Filed under:
|
|

Hi,

Suppose I have this array:

 $array = array('10', '20', '30.30', '40', '50');

Questions

What is the fastest/easiest way to remove the first item from the above array?
What is the fastest/easiest way to remove the last item from the above array?

So the resulting array contains only these values:

  • '20'
  • '30.30'
  • '40'

© Stack Overflow or respective owner

Related posts about php

Related posts about web-development