0
Good
I have a function that generates the name for the friendly urls but I’m having a problem that when the function generates the name if that name contains accents it does not put the same word but without accent puts another character
Function
function url_amigavel($string) {
$palavra = strtr($string, "ŠŒŽšœžŸ¥µÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿ", "SOZsozYYuAAAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyy");
$palavranova = str_replace("_", " ", $palavra);
$pattern = '|[^a-zA-Z0-9\-]|'; $palavranova = preg_replace($pattern, ' ', $palavranova);
$string = str_replace(' ', '-', $palavranova);
$string = str_replace('---', '-', $string);
$string = str_replace('--', '-', $string);
return strtolower($string);
}
For example
César Sousa
You should convert to cesar-Sousa But it’s converting like this c-Sar-Sousa
Really with the function that @P. Santos put worked but in some I noticed that it was not working well but with this one it worked right thanks to the two for the help
– César Sousa