|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-12-07 13:37 UTC] mark at seventhcycle dot net
#15972, which is open right now, had some good thoughts on how to expand strip_tags...
My suggestion:
1. Add a third/fourth parameter to it that (if specified) says what to change the brackets *to* instead of replacing them.
e.g.:
strip_tags("<b>hi</b><i>there</i>", "<b>", "<", ">");
would have an output of:
<b>hi</b> <there>
The point of this is so that rather than strip away tags that are invalid, a forum would be able to see code just fine.. Well, that, and we'd be able to have brackets on the site without typing in the html equivalent ;)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 23:00:01 2025 UTC |
Your example is inconsistent with your explanation. Does the following look like the behavior you had in mind? strip_tags("<b>hi</b><i>there</i>", "<b>", "<", ">"); would have an output of: <b>hi</b><i>there</i>Use strtr() it will be much faster then modifying strip_tags with the suggested functionality. strtr($your_string, array(">" => ">", "<" => "<"));