note 106098 added to function.strip-tags
| From: | dhgouveia at hotmail dot com | Date: | Mon, 10 Oct 2011 11:09:14 +0000 |
| Subject: | note 106098 added to function.strip-tags | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-183762@lists.php.net to get a copy of this message | ||
this is just for strip the inside tags
<?php
$allow = '<p><ul><li><b><strong>';
$str = '<p
style="text-align:center">Paragraph</p><strong>Bold</strong><br/><span
style="color:red">Red</span><h1>Header</h1>';
$result = strip_tags($str,$allow);
$result = clean_inside_tags($result,$allow);
echo '<textarea>'.$result.'</textarea>';
//Clean the inside of the tags
function clean_inside_tags($txt,$tags){
preg_match_all("/<([^>]+)>/i",$tags,$allTags,PREG_PATTERN_ORDER);
foreach ($allTags[1] as $tag){
$txt =
preg_replace("/<".$tag."[^>]*>/i","<".$tag.">",$txt);
}
return $txt;
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 79.155.140.105
----
Manual Page -- http://www.php.net/manual/en/function.strip-tags.php
Edit -- https://master.php.net/note/edit/106098
Del: integrated -- https://master.php.net/note/delete/106098/integrated
Del: useless -- https://master.php.net/note/delete/106098/useless
Del: bad code -- https://master.php.net/note/delete/106098/bad+code
Del: spam -- https://master.php.net/note/delete/106098/spam
Del: non-english -- https://master.php.net/note/delete/106098/non-english
Del: in docs -- https://master.php.net/note/delete/106098/in+docs
Del: other reasons-- https://master.php.net/note/delete/106098
Reject -- https://master.php.net/note/reject/106098
Search -- https://master.php.net/manage/user-notes.php