> Fonction inverse unhtmlentities et caractère \"euro\"La fonction htmlentities de php convertit les caractères spéciaux en caractères html plus compatibles. Il est utile de pouvoir faire l'inverse. €
function unhtmlentities($string)
{
$string=purge_iso88591($string);
$string = eregi_replace('€', 'euro', $string);
$string = str_replace('€', 'euro', $string);
// Remplace les entités numériques
$string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\\\1"))', $string);
$string = preg_replace('~&#([0-9]+);~e', 'chr("\\\\1")', $string);
// Remplace les entités litérales
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
$trans_tbl = array_flip($trans_tbl);
return strtr($string, $trans_tbl);
}
retour