Unlike HTML tags, objects (such as < or ) represent valid characters.
If you remove all objects from the HTML fragment, you will close all < characters, as well as any other characters that were included as objects.
You need to decode the objects into the characters that they represent using the html_entity_decode function.
SLaks source share