note 31021 deleted from function.strpos by tularis
| From: | tularis@php.net | Date: | Wed, 22 Aug 2007 13:26:57 +0000 |
| Subject: | note 31021 deleted from function.strpos by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-129701@lists.php.net to get a copy of this message | ||
Note Submitter: wodzuY2k at interia dot pl
----
this loop removes <script>.*</script> tags from HTML contents.
<?php
while(true)
{
$begPos = strpos($contents,"<script");
if ($begPos===false) break; //all tags were found & replaced.
$endPos = strpos($contents,"script>",$begPos+strlen("<script"));
$tmp = substr($contents,0,$begPos);
$tmp .= substr($contents,$endPos+strlen("script>"));
$contents = $tmp;
if ($loopcontrol++>100) break; //loop infinity control
continue; //search again
};
?>