Str.php
public static function toAscii(string $str) : string
    {
        if (preg_match("/[\x80-\xFF]/", $str)) {
            // Grab the transliteration table since we'll need it.
            if (null === static::$ascii) {
                static::$ascii = unserialize(file_get_contents(__DIR__ . '/str/resources/transliteration_table.ser'));
            }

            $str = \Normalizer::normalize($str, \Normalizer::NFKD);
            $str = preg_replace('/\p{Mn}+/u', '', $str);
            $str = str_replace(static::$ascii[0], static::$ascii[1], $str);
            $str = iconv('UTF-8', 'ASCII' . ('glibc' !== ICONV_IMPL ? '//IGNORE' : '') . '//TRANSLIT', $str);
        }

        return $str;
    }
public static function toAscii(string $str) : string
    {
        if (preg_match("/[\x80-\xFF]/", $str)) {
            // Grab the transliteration table since we'll need it.
            if (null === static::$ascii) {
                static::$ascii = unserialize(file_get_contents(__DIR__ . '/str/resources/transliteration_table.ser'));
            }

            $str = \Normalizer::normalize($str, \Normalizer::NFKD);
            $str = preg_replace('/\p{Mn}+/u', '', $str);
            $str = str_replace(static::$ascii[0], static::$ascii[1], $str);
            $str = iconv('UTF-8', 'ASCII' . ('glibc' !== ICONV_IMPL ? '//IGNORE' : '') . '//TRANSLIT', $str);
        }

        return $str;
    }
public static function toAscii ( string $ str ) : string { if ( preg_match ( "/[\x80-\xFF]/" , $ str ) ) { // Grab the transliteration table since we'll need it. if ( null === static :: $ ascii ) { static :: $ ascii = unserialize ( file_get_contents ( __DIR__ . '/str/resources/transliteration_table.ser' ) ) ; } $ str = \ Normalizer :: normalize ( $ str , \ Normalizer :: NFKD ) ; $ str = preg_replace ( '/\p{Mn}+/u' , '' , $ str ) ; $ str = str_replace ( static :: $ ascii [ 0 ] , static :: $ ascii [ 1 ] , $ str ) ; $ str = iconv ( 'UTF-8' , 'ASCII' . ( 'glibc' !== ICONV_IMPL ? '//IGNORE' : '' ) . '//TRANSLIT' , $ str ) ; } return $ str ; }
Transliterates an UTF-8 encoded string to its ASCII equivalent.

@param   string  $str    The UTF-8 encoded string to transliterate.
@return  string          The ASCII equivalent of the input string.
Transliterates an UTF - 8 encoded string to its ASCII equivalent .