derick Sat Dec 28 10:52:27 2002 EDT
Modified files:
/phpdoc/en/reference/strings/functions html-entity-decode.xml
Log:
- Add note on
Index: phpdoc/en/reference/strings/functions/html-entity-decode.xml
diff -u phpdoc/en/reference/strings/functions/html-entity-decode.xml:1.2
phpdoc/en/reference/strings/functions/html-entity-decode.xml:1.3
--- phpdoc/en/reference/strings/functions/html-entity-decode.xml:1.2 Mon Nov 18
12:26:12 2002
+++ phpdoc/en/reference/strings/functions/html-entity-decode.xml Sat Dec 28
+10:52:27 2002
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/strings.xml, last change in rev 1.2 -->
<refentry id="function.html-entity-decode">
<refnamediv>
@@ -77,9 +77,9 @@
// 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);
@@ -90,6 +90,17 @@
]]>
</programlisting>
</example>
+ </para>
+ <para>
+ <note>
+ <para>
+ 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
+ <function>trim</function>) but ASCII code 160 (0xa0) in the default ISO
+ 8859-1 characterset.
+ </para>
+ </note>
</para>
<para>
See also <function>htmlentities</function>,
--
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php