Função html_entity_decode
A função html_entity_decode converte
entidades HTML em símbolos correspondentes.
Veja os exemplos para melhor compreensão.
Sintaxe
html_entity_decode(string $string, int $flags = ENT_COMPAT, ?string $encoding = null): string
Exemplo
Vamos converter uma string com tags:
<?php
$str = '<b>text</b>';
$res = html_entity_decode($str);
echo $res;
?>
Resultado da execução do código:
'<b>text</b>'
Exemplo
Vamos converter uma string com & comercial:
<?php
$str = 'test: &';
$res = html_entity_decode($str);
echo $res;
?>
Resultado da execução do código:
'test: &'
Veja também
-
a função
htmlentities,
que executa a operação inversa -
a função
htmlspecialchars,
que executa uma operação inversa similar