note 77280 deleted from function.strip-tags by nlopess
| From: | nlopess@php.net | Date: | Sat, 01 Sep 2007 16:34:00 +0000 |
| Subject: | note 77280 deleted from function.strip-tags by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-130061@lists.php.net to get a copy of this message | ||
Note Submitter: ElCoder
Reason: 3
----
PHP strip_tags has a small issue. When you try to strip this:
<p>Separate</p><p>Words</p>
you will get: SeaparateWords linked together.
The natural way to strip Paragraphs is to add space between them. I also needed images to be
replaced with their alt attribute's value.
So I decided to write a new stripTags function to suit my needs and works a bit differently than the
PHP one.
You can find it here:
http://www.tellinya.com/art2/61/strip_tags
as the code is not that short and it has details on how to use it.
If you find bugs post them on site and I'll address them asap as I rely heavily on this
function.
PS: Of course HTML has to be well formed for the function to do its best.