public function regionMatches(int $offset, $string, int $strOffset, int $len, bool $ignoreCase = false): bool
    {
        Assert::typeOf(['string', __CLASS__], $string);
        $strLen = \is_string($string) ? mb_strlen($string, $this->encoding) : $string->length();

        if ($offset < 0 || $strOffset < 0 || ($strOffset + $len) > $strLen || ($offset + $len) > $this->length()) {
            return false;
        }

        $stringA = mb_substr($this->data, $offset, $len, $this->encoding);
        $stringB = mb_substr((string) $string, $strOffset, $len, $this->encoding);

        // Compare strings
        if ($ignoreCase) {
            $result = strcmp(mb_strtolower($stringA, $this->encoding), mb_strtolower($stringB, $this->encoding));
        } else {
            $result = strcmp($stringA, $stringB);
        }

        return $result === 0;
    }
public function regionMatches(int $offset, $string, int $strOffset, int $len, bool $ignoreCase = false): bool
    {
        Assert::typeOf(['string', __CLASS__], $string);
        $strLen = \is_string($string) ? mb_strlen($string, $this->encoding) : $string->length();

        if ($offset < 0 || $strOffset < 0 || ($strOffset + $len) > $strLen || ($offset + $len) > $this->length()) {
            return false;
        }

        $stringA = mb_substr($this->data, $offset, $len, $this->encoding);
        $stringB = mb_substr((string) $string, $strOffset, $len, $this->encoding);

        // Compare strings
        if ($ignoreCase) {
            $result = strcmp(mb_strtolower($stringA, $this->encoding), mb_strtolower($stringB, $this->encoding));
        } else {
            $result = strcmp($stringA, $stringB);
        }

        return $result === 0;
    }
public function regionMatches ( int $ offset , $ string , int $ strOffset , int $ len , bool $ ignoreCase = false ) : bool { Assert :: typeOf ( [ 'string' , __CLASS__ ] , $ string ) ; $ strLen = \ is_string ( $ string ) ? mb_strlen ( $ string , $ this -> encoding ) : $ string -> length ( ) ; if ( $ offset < 0 || $ strOffset < 0 || ( $ strOffset + $ len ) > $ strLen || ( $ offset + $ len ) > $ this -> length ( ) ) { return false ; } $ stringA = mb_substr ( $ this -> data , $ offset , $ len , $ this -> encoding ) ; $ stringB = mb_substr ( ( string ) $ string , $ strOffset , $ len , $ this -> encoding ) ; // Compare strings if ( $ ignoreCase ) { $ result = strcmp ( mb_strtolower ( $ stringA , $ this -> encoding ) , mb_strtolower ( $ stringB , $ this -> encoding ) ) ; } else { $ result = strcmp ( $ stringA , $ stringB ) ; } return $ result === 0 ; }
Checks if two string regions are equal

@param int           $offset
@param static|string $string
@param int           $strOffset
@param int           $len
@param boolean       $ignoreCase
@return boolean
@throws InvalidArgumentException
@throws TypeError
Checks if two string regions are equal