From 23b59804119948f9e18834deaeef355b2a83e434 Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Sat, 28 Dec 2002 15:52:27 +0000 Subject: [PATCH] - Add note on   git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@109281 c90b9560-bf6c-de11-be94-00142212c4b1 --- .../strings/functions/html-entity-decode.xml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/reference/strings/functions/html-entity-decode.xml b/reference/strings/functions/html-entity-decode.xml index bc7939cf58..6f2561bc7f 100644 --- a/reference/strings/functions/html-entity-decode.xml +++ b/reference/strings/functions/html-entity-decode.xml @@ -1,5 +1,5 @@ - + @@ -77,9 +77,9 @@ 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); + $trans_tbl = get_html_translation_table (HTML_ENTITIES); + $trans_tbl = array_flip ($trans_tbl); + return strtr ($string, $trans_tbl); } $c = unhtmlentities($a); @@ -91,6 +91,17 @@ echo $c; // I'll "walk" the dog now + + + + You might wonder why trim(html_entity_decode(' ')); doesn't + reduce the string to an empty string, that's because the ' ' + entity is not ASCII code 32 (which is stripped by + trim) but ASCII code 160 (0xa0) in the default ISO + 8859-1 characterset. + + + See also htmlentities, htmlspecialchars,