function removeAccents(string $s): string { setlocale(LC_ALL, 'en_US.UTF8'); // Might have side-effects return iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $s); }This will change bière -> biere The setlocale() changes the global locale for your entire program so that might cause side-effects but without it, if you are in the C locale, the accented letters will become question marks.
Programming Tips - PHP: remove accents from a string in php
Date: 2017sep30
Language: php
Q. PHP: remove accents from a string in php
A. Use iconv() like this: