Funzione html_entity_decode
La funzione html_entity_decode converte
le entità HTML nei corrispondenti caratteri.
Guarda gli esempi per una migliore comprensione.
Sintassi
html_entity_decode(string $string, int $flags = ENT_COMPAT, ?string $encoding = null): string
Esempio
Convertiamo una stringa con tag:
<?php
$str = '<b>text</b>';
$res = html_entity_decode($str);
echo $res;
?>
Risultato dell'esecuzione del codice:
'<b>text</b>'
Esempio
Convertiamo una stringa con una e commerciale:
<?php
$str = 'test: &';
$res = html_entity_decode($str);
echo $res;
?>
Risultato dell'esecuzione del codice:
'test: &'
Guarda anche
-
la funzione
htmlentities,
che esegue l'operazione inversa -
la funzione
htmlspecialchars,
che esegue un'operazione inversa simile