I have some HTML as a string in PHP that I've used $html_str= html_entity_decode()
on. So a sample of the HTML now looks like this:
echo $html_str; // <p>This is <span class='some_class'>some</span> text, yeah!<br>Hello world.</p>
When I do this:
$html_str= strip_tags($html_str, '<p>');
echo $html_str; // This is some text, yeah!Hello world.
it strips all tags including the <p>
tags.
But if I do:
$html_str= strip_tags($html_str, '<br>');
echo $html_str; // <p>This is some text, yeah!<br>Hello world.</p>
it strips the <span>
tags and leaves the <br>
and the <p>
.
What's going on here?