note 24114 deleted from function.strip-tags by nlopess
| From: | nlopess@php.net | Date: | Thu, 11 Mar 2004 14:53:43 +0000 |
| Subject: | note 24114 deleted from function.strip-tags by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-66644@lists.php.net to get a copy of this message | ||
Note Submitter: wil@tech-inc.com
----
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);