note 71702 deleted from function.strip-tags by nlopess
| From: | nlopess@php.net | Date: | Sun, 17 Dec 2006 19:34:09 +0000 |
| Subject: | note 71702 deleted from function.strip-tags by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-120702@lists.php.net to get a copy of this message | ||
Note Submitter: lightcube at gmail dot com
----
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/ .