note 16787 deleted from function.strip-tags by nlopess
| From: | nlopess@php.net | Date: | Thu, 11 Mar 2004 14:52:43 +0000 |
| Subject: | note 16787 deleted from function.strip-tags by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-66640@lists.php.net to get a copy of this message | ||
Note Submitter: kverens@contactjuggling.org
----
The strip_tags() function has trouble with pages that include JavaScript. I've gotten around
this by HTML-commenting out the JavaScript correctly ("<!--" at the beginning, and
"// -->" at the end of the script), and preceding calls to strip_tags() with:
$text=preg_replace('/<!--.+?-->/','',$text);
This assumes that the HTML has been imploded to get rid of line-breaks.