protected static function ourSubstr($str, $start = 0, $length = null)
    {
        // Premature optimization: cache the function_exists() result
        static $exists = null;
        if ($exists === null) {
            $exists = \function_exists('\\mb_substr');
        }

        // If it exists, we need to make sure we're using 8bit mode
        if ($exists) {
            return \mb_substr($str, $start, $length, '8bit');
        } elseif ($length !== null) {
            return \substr($str, $start, $length);
        }
        return \substr($str, $start);
    }
protected static function ourSubstr($str, $start = 0, $length = null)
    {
        // Premature optimization: cache the function_exists() result
        static $exists = null;
        if ($exists === null) {
            $exists = \function_exists('\\mb_substr');
        }

        // If it exists, we need to make sure we're using 8bit mode
        if ($exists) {
            return \mb_substr($str, $start, $length, '8bit');
        } elseif ($length !== null) {
            return \substr($str, $start, $length);
        }
        return \substr($str, $start);
    }
protected static function ourSubstr ( $ str , $ start = 0 , $ length = null ) { // Premature optimization: cache the function_exists() result static $ exists = null ; if ( $ exists === null ) { $ exists = \ function_exists ( '\\mb_substr' ) ; } // If it exists, we need to make sure we're using 8bit mode if ( $ exists ) { return \ mb_substr ( $ str , $ start , $ length , '8bit' ) ; } elseif ( $ length !== null ) { return \ substr ( $ str , $ start , $ length ) ; } return \ substr ( $ str , $ start ) ; }
Multi-byte-safe substring calculation

@param string $str
@param int $start
@param int $length (optional)
@return string
Multi - byte - safe substring calculation