note 23740 modified in function.strip-tags by philip
| From: | philip@php.net | Date: | Tue, 07 Jan 2003 00:20:35 +0000 |
| Subject: | note 23740 modified in function.strip-tags by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-41769@lists.php.net to get a copy of this message | ||
Hi,
Maybe this is useless but here is a code sequence that does the same in PHP:
$sStripped = '';
$bInside = false;
$iDepth = 0;
for ($iStripHtml = 0 ; $iStripHtml<$sLength; $iStripHtml++) {
if ($sContent[$iStripHtml] == '<') {
$bInside = true;
$iDepth++;
}
if ($sContent[$iStripHtml - 1] == '>' && ! (--$iDepth)) {
$bInside = false;
}
if (!$bInside) {
$sStripped .= $sContent[$iStripHtml];
}
}
$sContent = $sStripped;
echo '<hr>';
echo $sContent;
--was--
Hi,
Maybe this is useless but here is a code sequence that does the same in PHP:
$sStripped = '';
$bInside = false;
$iDepth = 0;
for ($iStripHtml = 0 ; $iStripHtml<$sLength; $iStripHtml++) {
if ($sContent[$iStripHtml] == '<') {
$bInside = true;
$iDepth++;
}
if ($sContent[$iStripHtml - 1] == '>' && ! (--$iDepth)) {
$bInside = false;
}
if (!$bInside) {
$sStripped .= $sContent[$iStripHtml];
}
}
$sContent = $sStripped;
echo '<hr>';
echo $sContent;
Calin Uioreanu
php9.com Weblog
http://www.php9.com
http://www.php.net/manual/en/function.strip-tags.php