Codice PHP:
function NomePaginaArtista($nome, $separatore='_')
{
$nome = strtolower(trim(stripslashes($nome)));
$nome = strip_tags($nome);
$nome = html_entity_decode($nome);
$nome = str_replace(array("-","_",".",",","[","]","{","}","¹","!","|",'$',"?","@","#","*","%","(",")","£","'",'”','“','"',"’","/","\\","<",">",":",";"), '', $nome);
$search = array (
"'([\r\n])[\s]+'", // Rimozione degli spazi bianchi
"'(á|à|â|ã|ä|å)'i",
"'æ'i",
"'ç'i",
"'(è|é|ê|ë)'i",
"'(ì|í|î|ï)'i",
"'(ÿ|ý)'i",
"'(ñ)'i",
"'(ð|ò|ó|ô|õ|ö)'i",
"'(ù|ú|û|ü)'i",
"'š'i",
"'&'i"
);
$replace = array (
"\\1",
"a",
"ae",
"c",
"e",
"i",
"o",
"u",
"y",
"n",
"s",
"e"
);
$nomeTemp = preg_replace($search, $replace, $nome);
$nomeTemp = str_replace(' ', $separatore , $nomeTemp);
$nomeTemp = str_replace(' ', '', $nomeTemp);
$ret = trim($nomeTemp);
return $ret;
}