CKTIS / PHP
html_entity_decode()
Convert supported named and numeric HTML entities to characters.
Version: PHP 8.4; repository runtime, production runtime not attested
Syntax
html_entity_decode(string $string, int $flags = ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, ?string $encoding = null): stringConvert supported named and numeric HTML entities to characters. The document-type flag selects the entity table, quote flags select which quotes decode, and encoding controls the output bytes. Decoding one layer of &lt; leaves <, not the less-than character.
Signature
html_entity_decode(string $string, int $flags = ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, ?string $encoding = null): string
Example output
["<","'","""]
Examples
<?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")]);
Result
["<","'","""]