note 34449 added to function.htmlentities
| From: | pinkpanther at swissonline dot ch | Date: | Mon, 28 Jul 2003 07:29:59 +0000 |
| Subject: | note 34449 added to function.htmlentities | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-52814@lists.php.net to get a copy of this message | ||
In case you want a 'htmlentities' function which prevents 'double' encoding of
the ampersands of already present entities (> => >), use this:
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,3};)/","&" ,
strtr($myHTML, $translation_table));
}
----
Manual Page -- http://www.php.net/manual/en/function.htmlentities.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34449
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34449&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34449&report=yes