来自strip_tags PHP的奇怪行为

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?

The second argument $allowable_tags says which tags are allowed:

<?php

$html_str = "<p>This is <span class='some_class'>some</span> text, yeah!<br>Hello world.</p>";

echo strip_tags($html_str, '<p>') . "
";

echo strip_tags($html_str, '<br>') . "
";

Output is:

<p>This is some text, yeah!Hello world.</p>
This is some text, yeah!<br>Hello world.

as expected.

http://ideone.com/5R3VvZ

The most likely explanation to me is that you don't really have <br> in your string but something else (is the HTML tag encoded?).