function filter(callable $closure) {
        $new = array();
        foreach($this->data as $key => $val) {
            $feed = (bool) $closure($val, $key);
            if($feed) {
                $new[$key] = $val;
            }
        }
        
        return (new self($new));
    }
function filter(callable $closure) {
        $new = array();
        foreach($this->data as $key => $val) {
            $feed = (bool) $closure($val, $key);
            if($feed) {
                $new[$key] = $val;
            }
        }
        
        return (new self($new));
    }
function filter ( callable $ closure ) { $ new = array ( ) ; foreach ( $ this -> data as $ key => $ val ) { $ feed = ( bool ) $ closure ( $ val , $ key ) ; if ( $ feed ) { $ new [ $ key ] = $ val ; } } return ( new self ( $ new ) ) ; }
Filters the collection by a given callback, keeping only those items that pass a given truth test. Returns a new Collection.
@param callable  $closure  Callback specification: `function ($value, $key): bool`
@return \CharlotteDunois\Collect\Collection
Filters the collection by a given callback keeping only those items that pass a given truth test . Returns a new Collection .