I'm bringing from BD Mysql the user data. The names were recorded in the upper case. I'm creating a greeting for this user by taking only the first name.
list($nome,$sobrenome) = explode(" ",$pe->NomeUsuario);
The result looks like this:
Welcome back TÚLIO
But I want to leave it this way:
Welcome back Túlio
For this I tried to do the function below:
function converter($palavra){ //
$minusculas = array("á", "à", "â", "ã", "ä", "é", "è", "ê", "ë", "í", "ì", "î", "ï", "ó", "ò", "ô", "õ", "ö", "ú", "ù", "û", "ü", "ç");
$maiusculas = array("Á", "À", "Â", "Ã", "Ä", "É", "È", "Ê", "Ë", "Í", "Ì", "Î", "Ï", "Ó", "Ò", "Ô", "Õ", "Ö", "Ú", "Ù", "Û", "Ü", "Ç");
$converter = str_replace($maiusculas, $minusculas, $palavra);
return ucfirst($converter);
}
list($nome,$sobrenome) = explode(" ",converter($pe->NomeUsuario));
But the result is:
TuLIO
How can I convert Túlio to Tulio?