src/ArrayLib.php
public static function getLastElement(array &$inputArray, $removeElement=false)
    {
        if (count($inputArray) > 0)
        {
            if (!$removeElement)
            {
                $element = end($inputArray);
            }
            else
            {
                $element = array_pop($inputArray);
            }
        }
        else
        {
            throw new \Exception('inputArray has no elements');
        }
        
        return $element;
    }
public static function getLastElement(array &$inputArray, $removeElement=false)
    {
        if (count($inputArray) > 0)
        {
            if (!$removeElement)
            {
                $element = end($inputArray);
            }
            else
            {
                $element = array_pop($inputArray);
            }
        }
        else
        {
            throw new \Exception('inputArray has no elements');
        }
        
        return $element;
    }
public static function getLastElement ( array & $ inputArray , $ removeElement = false ) { if ( count ( $ inputArray ) > 0 ) { if ( ! $ removeElement ) { $ element = end ( $ inputArray ) ; } else { $ element = array_pop ( $ inputArray ) ; } } else { throw new \ Exception ( 'inputArray has no elements' ) ; } return $ element ; }
Fetches the last element of an array
@param array &$inputArray - the array we want the last element of.
@param bool removeElement - override to true if you also want to remove that element
@return $element - the last element of the array.
Fetches the last element of an array