public function nth($position)
    {
        if ($position < 0) {
            $position = $this->count() + $position;
        }
        if ($position < 0 || $this->count() < $position) {
            throw new \InvalidArgumentException('Invalid Position');
        }

        $slice = array_slice($this->items, $position, 1);
        return empty($slice) ? null : reset($slice);
    }
public function nth($position)
    {
        if ($position < 0) {
            $position = $this->count() + $position;
        }
        if ($position < 0 || $this->count() < $position) {
            throw new \InvalidArgumentException('Invalid Position');
        }

        $slice = array_slice($this->items, $position, 1);
        return empty($slice) ? null : reset($slice);
    }
public function nth ( $ position ) { if ( $ position < 0 ) { $ position = $ this -> count ( ) + $ position ; } if ( $ position < 0 || $ this -> count ( ) < $ position ) { throw new \ InvalidArgumentException ( 'Invalid Position' ) ; } $ slice = array_slice ( $ this -> items , $ position , 1 ) ; return empty ( $ slice ) ? null : reset ( $ slice ) ; }
Get the nth item in the collection.
@param int $position
@return mixed
Get the nth item in the collection .