note 57703 added to function.strip-tags
| From: | Nyks at osu1 dot php dot net | Date: | Tue, 11 Oct 2005 20:39:59 +0000 |
| Subject: | note 57703 added to function.strip-tags | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-96867@lists.php.net to get a copy of this message | ||
Note for BRYN at drumdatabse dot com (http://www.php.net/manual/fr/function.strip-tags.php#52085) :
I've changed your script to support more possibilities.
- The first WHILE loop reiterates the second WHILE to strip_tags the html tags which possibly are
cuted by the substr() function (and not recognized by the strip_tags() function)
- There's no more bugs with substr($textstring,0,1024) ... yes, when the WHILE loop reiterates
for the second, third, fourth... time, if the length of $textstring is smaller than 1024 it returns
error
<?php
function strip_tags_in_big_string($textstring){
while($textstring != strip_tags($textstring))
{
while (strlen($textstring) != 0)
{
if (strlen($textstring) > 1024) {
$otherlen = 1024;
} else {
$otherlen = strlen($textstring);
}
$temptext = strip_tags(substr($textstring,0,$otherlen));
$safetext .= $temptext;
$textstring = substr_replace($textstring,'',0,$otherlen);
}
$textstring = $safetext;
}
return $textstring;
?>
----
Manual Page -- http://www.php.net/manual/en/function.strip-tags.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+57703
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57703&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57703&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57703&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57703&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57703&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57703&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57703&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+57703&report=yes
Search -- http://master.php.net/manage/user-notes.php