note 13526 deleted from function.strip-tags by jimw
| From: | jimw@php.net | Date: | Mon, 29 Oct 2001 01:34:40 +0000 |
| Subject: | note 13526 deleted from function.strip-tags by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-19546@lists.php.net to get a copy of this message | ||
If you want to remove tags, but keep the content between the opening and closing tag, try following:
for ($pos = 0, $SkippingTag = FALSE; $pos < strlen($str); $pos++)
{
if (!$SkippingTag)
{
if ($str[$pos] == '<')
$SkippingTag = TRUE;
else
$WithoutTags .= $str[$pos];
}
else
{
if ($str[$pos] == '>')
$SkippingTag = FALSE;
}
}
For example:<br>
Use this Snippet with<br>"<font><b>bold <i>+ italic<u>+
underline</u></i></b></font>"<br>will return<br>"bold
+ italic + underline".