public function filter(callable $callback = null)
    {
        if (is_null($callback)) {
            return new static($this->classname, array_filter($this->items));
        }

        return new static($this->classname, array_filter($this->items, $callback));
    }
public function filter(callable $callback = null)
    {
        if (is_null($callback)) {
            return new static($this->classname, array_filter($this->items));
        }

        return new static($this->classname, array_filter($this->items, $callback));
    }
public function filter ( callable $ callback = null ) { if ( is_null ( $ callback ) ) { return new static ( $ this -> classname , array_filter ( $ this -> items ) ) ; } return new static ( $ this -> classname , array_filter ( $ this -> items , $ callback ) ) ; }
Filter the elements in the collection using a callback function.

@param callable|null $callback

@return static
Filter the elements in the collection using a callback function .