diff --git a/reference/strings/functions/html-entity-decode.xml b/reference/strings/functions/html-entity-decode.xml new file mode 100644 index 0000000000..59b26de363 --- /dev/null +++ b/reference/strings/functions/html-entity-decode.xml @@ -0,0 +1,122 @@ + + + + + + html_entity_decode + + Convert all HTML entities to their applicable characters + + + + Description + + stringhtml_entity_decode + stringstring + intquote_style + stringcharset + + + html_entity_decode is the opposite of + htmlentities in that it converts all HTML entities + to their applicable characters from string. + + + The optional second quote_style parameter lets + you define what will be done with 'single' and "double" quotes. It takes + on one of three constants with the default being + ENT_COMPAT: + + Available <parameter>quote_style</parameter> constants + + + + Constant Name + Description + + + + + END_COMPAT + Will convert double-quotes and leave single-quotes alone. + + + ENT_QUOTES + Will convert both double and single quotes. + + + END_NOQUOTES + Will leave both double and single quotes unconverted. + + + +
+
+ + The ISO-8859-1 character set is used as default for the optional third + charset. This defines the character set used in + conversion. + + + + 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 + + +// For users prior to PHP 4.3.0 you may do this: +function unhtmlentities ($string) +{ + $trans_tbl = get_html_translation_table (HTML_ENTITIES); + $trans_tbl = array_flip ($trans_tbl); + return strtr ($string, $trans_tbl); +} + +$c = unhtmlentities($a); + +echo $c; // I'll "walk" the dog now + +?> +]]> + + + + + See also htmlentities, + htmlspecialchars, + get_html_translation_table, + htmlspecialchars and urldecode. + +
+
+ +