note 33530 deleted from function.htmlentities by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 17:11:09 +0000 |
| Subject: | note 33530 deleted from function.htmlentities by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-154953@lists.php.net to get a copy of this message | ||
Note Submitter: webwurst at web dot de
----
This function changes all entities to unicode-entities.
For example '<' becomes '<', '©' becomes
'©', etc.
function xmlentities($string, $quote_style=ENT_COMPAT)
{
$trans = get_html_translation_table(HTML_ENTITIES, $quote_style);
foreach ($trans as $key => $value)
$trans[$key] = '&#'.ord($key).';';
return strtr($string, $trans);
}