public function strlen($var) : int
    {
        $v = '' . $var;
        if ($v === '') {
            return 0;
        }
        if (static::$nativeSupport['mbstring']) {
            return mb_strlen($v);
        }

        $n = 0;
        $le = strlen($v);
        $leading = false;
        for ($i = 0; $i < $le; $i++) {
            // ASCII.
            if (($ord = ord($v{$i})) < 128) {
                ++$n;
                $leading = false;
            }
            // Continuation char.
            elseif ($ord < 192) {
                $leading = false;
            }
            // Leading char.
            else {
                // A sequence of leadings only counts as a single.
                if (!$leading) {
                    ++$n;
                }
                $leading = true;
            }
        }
        return $n;
    }
public function strlen($var) : int
    {
        $v = '' . $var;
        if ($v === '') {
            return 0;
        }
        if (static::$nativeSupport['mbstring']) {
            return mb_strlen($v);
        }

        $n = 0;
        $le = strlen($v);
        $leading = false;
        for ($i = 0; $i < $le; $i++) {
            // ASCII.
            if (($ord = ord($v{$i})) < 128) {
                ++$n;
                $leading = false;
            }
            // Continuation char.
            elseif ($ord < 192) {
                $leading = false;
            }
            // Leading char.
            else {
                // A sequence of leadings only counts as a single.
                if (!$leading) {
                    ++$n;
                }
                $leading = true;
            }
        }
        return $n;
    }
public function strlen ( $ var ) : int { $ v = '' . $ var ; if ( $ v === '' ) { return 0 ; } if ( static :: $ nativeSupport [ 'mbstring' ] ) { return mb_strlen ( $ v ) ; } $ n = 0 ; $ le = strlen ( $ v ) ; $ leading = false ; for ( $ i = 0 ; $ i < $ le ; $ i ++ ) { // ASCII. if ( ( $ ord = ord ( $ v { $ i } ) ) < 128 ) { ++ $ n ; $ leading = false ; } // Continuation char. elseif ( $ ord < 192 ) { $ leading = false ; } // Leading char. else { // A sequence of leadings only counts as a single. if ( ! $ leading ) { ++ $ n ; } $ leading = true ; } } return $ n ; }
Multibyte-safe string length.

@param mixed $var
Gets stringified.

@return int
Multibyte - safe string length .