note 44387 deleted from function.htmlentities by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 17:05:19 +0000 |
| Subject: | note 44387 deleted from function.htmlentities by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-154938@lists.php.net to get a copy of this message | ||
Note Submitter: attila at roughdot dot com
----
Thx for that function, pinkpanther at swissonline dot ch, though the number of digits after the
'#' can be 4, not 3.
I bumped into this when struggeling with the euro sign (€).
function htmlentities2( $myHTML)
{
$translation_table = get_html_translation_table( HTML_ENTITIES, ENT_QUOTES);
$translation_table[chr( 38)] = '&';
return preg_replace( "/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,4};)/",
"&" , strtr( $myHTML, $translation_table));
}