note 71702 added to function.strip-tags
| From: | lightcube at gmail dot com | Date: | Tue, 12 Dec 2006 15:54:07 +0000 |
| Subject: | note 71702 added to function.strip-tags | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-120551@lists.php.net to get a copy of this message | ||
I found a simple workaround to the issue of strip_tags not exluding standalone elements like Breaks
and Horizontal Rules in XHTML. Simply make sure all your standalone tags have a space between the
element and its forward slash; and/or add a duplicate exclusion for that element with a forward
slash in the strip_tags input:
<?php
$mystring = '<p>This is my string<br />And this is the second
line.</p>';
$mystring = strip_tags($mystring,'<p><br><br/>');
echo $mystring;
?>
There is a little more at http://www.shawnolson.net/a/1334/ .
----
Server IP: 216.194.113.175
Probable Submitter: 65.60.238.36
----
Manual Page -- http://www.php.net/manual/en/function.strip-tags.php
Edit -- https://master.php.net/note/edit/71702
Del: integrated -- https://master.php.net/note/delete/71702/integrated
Del: useless -- https://master.php.net/note/delete/71702/useless
Del: bad code -- https://master.php.net/note/delete/71702/bad+code
Del: spam -- https://master.php.net/note/delete/71702/spam
Del: non-english -- https://master.php.net/note/delete/71702/non-english
Del: in docs -- https://master.php.net/note/delete/71702/in+docs
Del: other reasons-- https://master.php.net/note/delete/71702
Reject -- https://master.php.net/note/reject/71702
Search -- https://master.php.net/manage/user-notes.php