protected function matchString(&$m, $delim)
    {
        $token = null;

        $end = strlen($this->buffer);

        // look for either ending delim, escape, or string interpolation
        foreach (['#{', '\\', $delim] as $lookahead) {
            $pos = strpos($this->buffer, $lookahead, $this->count);

            if ($pos !== false && $pos < $end) {
                $end = $pos;
                $token = $lookahead;
            }
        }

        if (! isset($token)) {
            return false;
        }

        $match = substr($this->buffer, $this->count, $end - $this->count);
        $m = [
            $match . $token,
            $match,
            $token
        ];
        $this->count = $end + strlen($token);

        return true;
    }
protected function matchString(&$m, $delim)
    {
        $token = null;

        $end = strlen($this->buffer);

        // look for either ending delim, escape, or string interpolation
        foreach (['#{', '\\', $delim] as $lookahead) {
            $pos = strpos($this->buffer, $lookahead, $this->count);

            if ($pos !== false && $pos < $end) {
                $end = $pos;
                $token = $lookahead;
            }
        }

        if (! isset($token)) {
            return false;
        }

        $match = substr($this->buffer, $this->count, $end - $this->count);
        $m = [
            $match . $token,
            $match,
            $token
        ];
        $this->count = $end + strlen($token);

        return true;
    }
protected function matchString ( & $ m , $ delim ) { $ token = null ; $ end = strlen ( $ this -> buffer ) ; // look for either ending delim, escape, or string interpolation foreach ( [ '#{' , '\\' , $ delim ] as $ lookahead ) { $ pos = strpos ( $ this -> buffer , $ lookahead , $ this -> count ) ; if ( $ pos !== false && $ pos < $ end ) { $ end = $ pos ; $ token = $ lookahead ; } } if ( ! isset ( $ token ) ) { return false ; } $ match = substr ( $ this -> buffer , $ this -> count , $ end - $ this -> count ) ; $ m = [ $ match . $ token , $ match , $ token ] ; $ this -> count = $ end + strlen ( $ token ) ; return true ; }
Match string looking for either ending delim, escape, or string interpolation

{@internal This is a workaround for preg_match's 250K string match limit. }}

@param array  $m     Matches (passed by reference)
@param string $delim Delimeter

@return boolean True if match; false otherwise
Match string looking for either ending delim escape or string interpolation