mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
- 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:
parent
da786eee2b
commit
23b5980411
1 changed files with 15 additions and 4 deletions
|
@ -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('&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>,
|
||||
<function>htmlspecialchars</function>,
|
||||
|
|
Loading…
Reference in a new issue