note 101348 added to function.html-entity-decode
| From: | Anonymous at osu1 dot php dot net | Date: | Sat, 11 Dec 2010 19:38:15 +0000 |
| Subject: | note 101348 added to function.html-entity-decode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-174802@lists.php.net to get a copy of this message | ||
Sorry the function should be
function unhtmlentities($string)
{
// replace numeric entities
$string = preg_replace('~&#x([0-9a-f]+);~ei',
'chr(hexdec("\\1"))', $string);
$string = preg_replace('~�*([0-9]+);~e', 'chr("\\1")',
$string);
// replace literal entities
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
$trans_tbl = array_flip($trans_tbl);
return strtr($string, $trans_tbl);
}
~�*([0-9]+);~e
rather than
~�*([1-9]+);~e
----
Server IP: 69.147.83.197
Probable Submitter: 212.107.119.82
----
Manual Page -- http://www.php.net/manual/en/function.html-entity-decode.php
Edit -- https://master.php.net/note/edit/101348
Del: integrated -- https://master.php.net/note/delete/101348/integrated
Del: useless -- https://master.php.net/note/delete/101348/useless
Del: bad code -- https://master.php.net/note/delete/101348/bad+code
Del: spam -- https://master.php.net/note/delete/101348/spam
Del: non-english -- https://master.php.net/note/delete/101348/non-english
Del: in docs -- https://master.php.net/note/delete/101348/in+docs
Del: other reasons-- https://master.php.net/note/delete/101348
Reject -- https://master.php.net/note/reject/101348
Search -- https://master.php.net/manage/user-notes.php