ThoHua ThoHua - 4 months ago 24
HTML Question

Stuck with strip_tags why not working in my code?

I want to remove quotes and html tags from following string:

$mystring='Example string "I want to remove any html tags ABC<sub>DE</sub> from <p>similar</p> types of string?"';

I am using following scripts to remove it but it's doesn't work for me:

echo strip_tags(htmlentities($mystring,ENT_QUOTES));

I want to following output for above string:

Example string "I want to remove any html tags ABCDE from similar types of string?"

Why strip is not working?What I mess here?


At first use strip_tags function if you want remove html tags then use htmlentities as follow it should be work:

echo htmlentities(strip_tags($mystring),ENT_QUOTES);