CKTIS / PHP
html_entity_decode()
Substitui as entidades HTML suportadas, com nome ou numéricas, por carateres.
Versão: PHP 8.4; repository runtime, production runtime not attested
Sintaxe
html_entity_decode(string $string, int $flags = ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, ?string $encoding = null): stringSubstitui as entidades HTML suportadas, com nome ou numéricas, por carateres. O tipo de documento escolhe as entidades, as opções de aspas controlam a sua descodificação e encoding define os bytes de saída. Uma passagem transforma &lt; em <.
Assinatura
html_entity_decode(string $string, int $flags = ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, ?string $encoding = null): string
Saída do exemplo
["<","'","""]
Exemplos
<?php
echo json_encode([html_entity_decode("&lt;",ENT_QUOTES|ENT_HTML5,"UTF-8"),html_entity_decode("'",ENT_QUOTES|ENT_HTML5,"UTF-8"),html_entity_decode(""",ENT_NOQUOTES|ENT_HTML5,"UTF-8")]);
Resultado
["<","'","""]