strip_tags
usually works fine. But with the string below, it’s buggy:
$string = '
BEGINNING
END
';
echo strip_tags($string);
The code above outputs:
BEGINNING
for (let i=0;i
Which is incorrect, because the END
div was not displayed. I think strip_tags
got confused with
So, if strip_tags
is not reliable for this case, is there any other native function or thing that I can do? I dont want to parse the entire document just to get the tags stripped, I have to parse millions of HTML strings each day and strip_tags
is being very good and has a good performance, but if I had to parse all HTML codes, it would take forever.