PHP - How to get the element before the last element from an array?

arrays, element, php

Solution

$array[count($array)-2]

It should be a numerically indexed array (from zero). You should have at least 2 elements for this to work. (obviously)

Problem

How can I get the element before the last element from an array in PHP5 ?

Original source