src/ArrayObject.php
public function last()
    {
        if (!$this->isCollection()) {
            return $this;
        }

        return isset($this->data[0]) ? $this->box(ArrayUtility::last($this->data)) : null;
    }
public function last()
    {
        if (!$this->isCollection()) {
            return $this;
        }

        return isset($this->data[0]) ? $this->box(ArrayUtility::last($this->data)) : null;
    }
public function last ( ) { if ( ! $ this -> isCollection ( ) ) { return $ this ; } return isset ( $ this -> data [ 0 ] ) ? $ this -> box ( ArrayUtility :: last ( $ this -> data ) ) : null ; }
Returns the last element in the collection.

@return ArrayObjectInterface|null
Returns the last element in the collection .