I have a code its working deleting dots and allow dot extension but the accent looks like:
Sin título => Sin_tÃ_tulo
$new_name = preg_replace("/\W(?=.*\.[^.]*$)/", "_", $string);
I want to delete accent or change for underscore
I have a code its working deleting dots and allow dot extension but the accent looks like:
Sin título => Sin_tÃ_tulo
$new_name = preg_replace("/\W(?=.*\.[^.]*$)/", "_", $string);
I want to delete accent or change for underscore
Two propositions using intl (if this module is missing in your config, install it):
$tls = Transliterator::createFromRules("::Latin-ASCII; [^A-Za-z0-9] > '_' ");
echo $tls->transliterate("Sin título"); // Sin_titulo
or:
$tls = Transliterator::createFromRules("::NFD; [^A-Za-z0-9] > '_' ");
echo $tls->transliterate("Sin título"); // Sin_ti_tulo