protected function sequenceMatches($sequence) {
        $len = strlen($sequence);
        $buffer = '';
        for ($i = 0; $i < $len; ++$i) {
            $buffer .= $this->scanner->current();

            // EOF. Rewind and let the caller handle it.
            if ($this->scanner->current() === false) {
                $this->scanner->unconsume($i);
                return false;
            }
            $this->scanner->next();
        }

        $this->scanner->unconsume($len);
        return $buffer == $sequence;
    }
protected function sequenceMatches($sequence) {
        $len = strlen($sequence);
        $buffer = '';
        for ($i = 0; $i < $len; ++$i) {
            $buffer .= $this->scanner->current();

            // EOF. Rewind and let the caller handle it.
            if ($this->scanner->current() === false) {
                $this->scanner->unconsume($i);
                return false;
            }
            $this->scanner->next();
        }

        $this->scanner->unconsume($len);
        return $buffer == $sequence;
    }
protected function sequenceMatches ( $ sequence ) { $ len = strlen ( $ sequence ) ; $ buffer = '' ; for ( $ i = 0 ; $ i < $ len ; ++ $ i ) { $ buffer .= $ this -> scanner -> current ( ) ; // EOF. Rewind and let the caller handle it. if ( $ this -> scanner -> current ( ) === false ) { $ this -> scanner -> unconsume ( $ i ) ; return false ; } $ this -> scanner -> next ( ) ; } $ this -> scanner -> unconsume ( $ len ) ; return $ buffer == $ sequence ; }
Check if upcomming chars match the given sequence.

This will read the stream for the $sequence. If it's
found, this will return true. If not, return false.
Since this unconsumes any chars it reads, the caller
will still need to read the next sequence, even if
this returns true.

Example: $this->sequenceMatches('</script>') will
see if the input stream is at the start of a
'</script>' string.
Check if upcomming chars match the given sequence .