note 13526 added to function.strip-tags.php

From: Date: Wed, 20 Jun 2001 12:40:58 +0000
Subject: note 13526 added to function.strip-tags.php
Groups: php.notes 
Request: Send a blank email to php-notes+get-14488@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". http://www.php.net/manual/en/function.strip-tags.php

« previous php.notes (#14488) next »