I'm having some problems using strip_tags PHP function when the string contains 'less than' and 'greater than' signs. For example:
If I do:
strip_tags("<span>some text <5ml and then >10ml some text </span>");
I'll get:
some text 10ml some text
But, obviously I want to get:
some text <5ml and then >10ml some text
Yes I know that I could use < and >, but I don't have chance to convert those characters into HTML entities since data is already stored as you can see in my example.
What I'm looking for is a clever way to parse HTML in order to get rid only actual HTML tags.
Since TinyMCE was used for generate that data, I know which actual html tags could be used in any case, so a strip_tags($string, $black_list)
implementation would be more usefull than strip_tags($string, $allowable_tags)
.
Any thoughs?
<anything
is an opening tag, and as such should be removed. Sostrip_tags
is doing what you're asking it to... – Alister