html_entity_decode Convert HTML entities to their corresponding characters &reftitle.description; stringhtml_entity_decode stringstring intflagsENT_COMPAT stringnullencoding&null; html_entity_decode is the opposite of htmlentities in that it converts HTML entities in the string to their corresponding characters. More precisely, this function decodes all the entities (including all numeric entities) that a) are necessarily valid for the chosen document type — i.e., for XML, this function does not decode named entities that might be defined in some DTD — and b) whose character or characters are in the coded character set associated with the chosen encoding and are permitted in the chosen document type. All other entities are left as is. &reftitle.parameters; string The input string. flags A bitmask of one or more of the following flags, which specify how to handle quotes and which document type to use. The default is ENT_COMPAT | ENT_HTML401. Available <parameter>flags</parameter> constants Constant Name Description ENT_COMPAT Will convert double-quotes and leave single-quotes alone. ENT_QUOTES Will convert both double and single quotes. ENT_NOQUOTES Will leave both double and single quotes unconverted. ENT_HTML401 Handle code as HTML 4.01. ENT_XML1 Handle code as XML 1. ENT_XHTML Handle code as XHTML. ENT_HTML5 Handle code as HTML 5.
encoding &strings.parameter.encoding; &reference.strings.charsets;
&reftitle.returnvalues; Returns the decoded string. &reftitle.changelog; &Version; &Description; 8.0.0 encoding is nullable now. &reftitle.examples; Decoding HTML entities dog now"; $a = htmlentities($orig); $b = html_entity_decode($a); echo $a; // I'll "walk" the <b>dog</b> now echo $b; // I'll "walk" the dog now ?> ]]> &reftitle.notes; You might wonder why trim(html_entity_decode('&nbsp;')); doesn't reduce the string to an empty string, that's because the '&nbsp;' entity is not ASCII code 32 (which is stripped by trim) but ASCII code 160 (0xa0) in the default ISO 8859-1 encoding. &reftitle.seealso; htmlentities htmlspecialchars get_html_translation_table urldecode