note 24114 added to function.strip-tags
| From: | wil at tech-inc dot com | Date: | Wed, 07 Aug 2002 02:33:02 +0000 |
| Subject: | note 24114 added to function.strip-tags | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-34439@lists.php.net to get a copy of this message | ||
this works better i think:
$trans = array_flip(get_html_translation_table(HTML_ENTITIES));
//strip nonbreaking space, strip php tags, strip html tags, convert html entites, strip extra white
space
$search_clean = array("% %i", "%<\?.*\?>%Usi",
"%<[\/]*[^<>]*>%Usi", "%(\&[a-zA-Z0-9\#]+;)%es",
"%\s+%");
$replace_clean = array(" ", "", "",
"strtr('\\1',\$trans)", " ");
$clean = preg_replace($search_clean, $replace_clean, $text_to_clean);
--
http://www.php.net/manual/en/function.strip-tags.php
http://master.php.net/manage/user-notes.php?action=edit+24114
http://master.php.net/manage/user-notes.php?action=delete+24114
http://master.php.net/manage/user-notes.php?action=reject+24114