- Add note on  

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@109281 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Derick Rethans 2002-12-28 15:52:27 +00:00
parent da786eee2b
commit 23b5980411

View file

@ -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 @@ echo $b; // I'll "walk" the <b>dog</b> 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 <b>dog</b> now
</programlisting>
</example>
</para>
<para>
<note>
<para>
You might wonder why trim(html_entity_decode('&amp;nbsp;')); doesn't
reduce the string to an empty string, that's because the '&amp;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>,
<function>htmlspecialchars</function>,