function last(callable $closure = null) {
        if($closure === null) {
            if(empty($this->data)) {
                return null;
            }
            
            $keys = \array_keys($this->data);
            return $this->data[$keys[(\count($keys) - 1)]];
        }
        
        $data = null;
        foreach($this->data as $key => $val) {
            $feed = $closure($val, $key);
            if($feed) {
                $data = $val;
            }
        }
        
        return $data;
    }
function last(callable $closure = null) {
        if($closure === null) {
            if(empty($this->data)) {
                return null;
            }
            
            $keys = \array_keys($this->data);
            return $this->data[$keys[(\count($keys) - 1)]];
        }
        
        $data = null;
        foreach($this->data as $key => $val) {
            $feed = $closure($val, $key);
            if($feed) {
                $data = $val;
            }
        }
        
        return $data;
    }
function last ( callable $ closure = null ) { if ( $ closure === null ) { if ( empty ( $ this -> data ) ) { return null ; } $ keys = \ array_keys ( $ this -> data ) ; return $ this -> data [ $ keys [ ( \ count ( $ keys ) - 1 ) ] ] ; } $ data = null ; foreach ( $ this -> data as $ key => $ val ) { $ feed = $ closure ( $ val , $ key ) ; if ( $ feed ) { $ data = $ val ; } } return $ data ; }
Returns the last element in the collection that passes a given truth test.
@param callable|null  $closure  Callback specification: `function ($value, $key): bool`
@return mixed|null
Returns the last element in the collection that passes a given truth test .