Get second to last value in array
Posted
by zaf
on Stack Overflow
See other posts from Stack Overflow
or by zaf
Published on 2010-05-17T14:44:14Z
Indexed on
2010/05/17
14:51 UTC
Read the original article
Hit count: 229
I'm frequently using the following to get the second to last value in an array:
$z=array_pop(array_slice($array,-2,1));
Am I missing a php function to do that in one go or is that the best I have?
© Stack Overflow or respective owner