Remove diacritics from a string

Richard Knop picture Richard Knop · Sep 3, 2010 · Viewed 32.4k times · Source

Is it possible? This is my input string:

ľ š č ť ž ý á í é Č Á Ž Ý

This is the output I want:

l s c t z y a i e C A Z Y

Answer

gabo picture gabo · Feb 3, 2016

if you have http://php.net/manual/en/book.intl.php available, you can use this:

$string = "Fóø Bår";
$transliterator = Transliterator::createFromRules(':: Any-Latin; :: Latin-ASCII; :: NFD; :: [:Nonspacing Mark:] Remove; :: Lower(); :: NFC;', Transliterator::FORWARD);
echo $normalized = $transliterator->transliterate($string);