I use the strip_tags()
function, but I need to remove some tags (and all of their contents).
eg:
<div> <p class="test"> Test A </p> <span> Test B </span> <div> Test C </div> </div>
Let's say I need to get rid of the P and SPAN tags and save only:
<div> <div> Test C </div> </div>
strip_tags
expects the tags you want to use as the second parameter.
In this particular example, I could use striptags($html, "<div>");
but the html I am clearing and the tags that need to be removed are always different.
I was looking for a watch for a function that fits my needs, but could not find anything useful.
Any idea?
source share