Funzione html_entity_decode

La funzione html_entity_decode converte le entità HTML nei corrispondenti caratteri. Guarda gli esempi per una migliore comprensione.

Sintassi

phphtml_entity_decode(string $string, int $flags = ENT_COMPAT, ?string $encoding = null): string

Esempio

Convertiamo una stringa con tag:

php<?php
  $str = '<b>text</b>';
  $res = html_entity_decode($str);
  
  echo $res;
?>

Risultato dell'esecuzione del codice:

php'<b>text</b>'

Esempio

Convertiamo una stringa con una e commerciale:

php<?php
  $str = 'test: &';
  $res = html_entity_decode($str);
  
  echo $res;
?>

Risultato dell'esecuzione del codice:

php'test: &'

Guarda anche