src/Language/Lexer.php
private function readChars($charCount, $advance = false, $byteStreamPosition = null)
    {
        $result     = '';
        $totalBytes = 0;
        $byteOffset = $byteStreamPosition ?: $this->byteStreamPosition;

        for ($i = 0; $i < $charCount; $i++) {
            [$char, $code, $bytes] = $this->readChar(false, $byteOffset);
            $totalBytes           += $bytes;
            $byteOffset           += $bytes;
            $result               .= $char;
        }
        if ($advance) {
            $this->moveStringCursor($charCount, $totalBytes);
        }

        return [$result, $totalBytes];
    }
private function readChars($charCount, $advance = false, $byteStreamPosition = null)
    {
        $result     = '';
        $totalBytes = 0;
        $byteOffset = $byteStreamPosition ?: $this->byteStreamPosition;

        for ($i = 0; $i < $charCount; $i++) {
            [$char, $code, $bytes] = $this->readChar(false, $byteOffset);
            $totalBytes           += $bytes;
            $byteOffset           += $bytes;
            $result               .= $char;
        }
        if ($advance) {
            $this->moveStringCursor($charCount, $totalBytes);
        }

        return [$result, $totalBytes];
    }
private function readChars ( $ charCount , $ advance = false , $ byteStreamPosition = null ) { $ result = '' ; $ totalBytes = 0 ; $ byteOffset = $ byteStreamPosition ? : $ this -> byteStreamPosition ; for ( $ i = 0 ; $ i < $ charCount ; $ i ++ ) { [ $ char , $ code , $ bytes ] = $ this -> readChar ( false , $ byteOffset ) ; $ totalBytes += $ bytes ; $ byteOffset += $ bytes ; $ result .= $ char ; } if ( $ advance ) { $ this -> moveStringCursor ( $ charCount , $ totalBytes ) ; } return [ $ result , $ totalBytes ] ; }
Reads next $numberOfChars UTF8 characters from the byte stream, starting from $byteStreamPosition.

@param int  $charCount
@param bool $advance
@param null $byteStreamPosition

@return (string|int)[]
Reads next $numberOfChars UTF8 characters from the byte stream starting from $byteStreamPosition .