I'm trying to use strip_tags
and trim
to detect if a string contains empty html?
$description = '<p> </p>';
$output = trim(strip_tags(html_entity_decode($description, ENT_QUOTES, 'UTF-8')));
var_dump($output);
string 'Â ' (length=2)
My debug to try figure this out:
$description = '<p> </p>';
$test = mb_detect_encoding($description);
$test .= "
";
$test .= trim(strip_tags(html_entity_decode($description, ENT_QUOTES, 'UTF-8')));
$test .= "
";
$test .= html_entity_decode($description, ENT_QUOTES, 'UTF-8');
file_put_contents('debug.txt', $test);
Output: debug.txt
ASCII
<p> </p>