phpstreams\Stream::filter PHP Method

filter() public method

Note that filter, like most stream operations, preserves the key => value relationship throughout its execution. That means that there will be missing keys, if you started with a regular array.
public filter ( callable $filter ) : Stream
$filter callable
return Stream a new stream yielding only the elements for which the callback returns true.
    public function filter(callable $filter)
    {
        return new FilterOperation($this, $filter);
    }