src/Collection/ImmArray.php
public function filter(callable $cb)
    {
        $count = count($this->sfa);
        $sfa = new SplFixedArray($count);
        $newCount = 0;

        foreach ($this->sfa as $el) {
            if ($cb($el)) {
                $sfa[$newCount++] = $el;
            }
        }

        $sfa->setSize($newCount);
        return new static($sfa);
    }
public function filter(callable $cb)
    {
        $count = count($this->sfa);
        $sfa = new SplFixedArray($count);
        $newCount = 0;

        foreach ($this->sfa as $el) {
            if ($cb($el)) {
                $sfa[$newCount++] = $el;
            }
        }

        $sfa->setSize($newCount);
        return new static($sfa);
    }
public function filter ( callable $ cb ) { $ count = count ( $ this -> sfa ) ; $ sfa = new SplFixedArray ( $ count ) ; $ newCount = 0 ; foreach ( $ this -> sfa as $ el ) { if ( $ cb ( $ el ) ) { $ sfa [ $ newCount ++ ] = $ el ; } } $ sfa -> setSize ( $ newCount ) ; return new static ( $ sfa ) ; }
Filter out elements

@param callable $cb Function to filter out on false
@return static
Filter out elements