note 70945 added to function.strip-tags
| From: | David at osu1 dot php dot net | Date: | Sun, 05 Nov 2006 19:29:51 +0000 |
| Subject: | note 70945 added to function.strip-tags | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-119411@lists.php.net to get a copy of this message | ||
<?php
/**
* strip_selected_tags ( string str [, string strip_tags[, strip_content flag]] )
* ---------------------------------------------------------------------
* Like strip_tags() but inverse; the strip_tags tags will be stripped, not kept.
* strip_tags: string with tags to strip, ex: "<a><p><quote>" etc.
* strip_content flag: TRUE will also strip everything between open and closed tag
*/
public function strip_selected_tags($str, $tags = "", $stripContent = false)
{
preg_match_all("/<([^>]+)>/i",$tags,$allTags,PREG_PATTERN_ORDER);
foreach ($allTags[1] as $tag){
if ($stripContent) {
$str =
preg_replace("/<".$tag."[^>]*>.*<\/".$tag.">/iU","",$str);
}
$str = preg_replace("/<\/?".$tag."[^>]*>/iU","",$str);
}
return $str;
}
?>
----
Server IP: 193.27.201.10 (proxied: 193.27.201.10 1.0 www1.shellkonto.se:3128 (squid/2.5.STABLE4))
Probable Submitter: 82.182.114.105
----
Manual Page -- http://www.php.net/manual/en/function.strip-tags.php
Edit -- https://master.php.net/note/edit/70945
Del: integrated -- https://master.php.net/note/delete/70945/integrated
Del: useless -- https://master.php.net/note/delete/70945/useless
Del: bad code -- https://master.php.net/note/delete/70945/bad+code
Del: spam -- https://master.php.net/note/delete/70945/spam
Del: non-english -- https://master.php.net/note/delete/70945/non-english
Del: in docs -- https://master.php.net/note/delete/70945/in+docs
Del: other reasons-- https://master.php.net/note/delete/70945
Reject -- https://master.php.net/note/reject/70945
Search -- https://master.php.net/manage/user-notes.php