I have a string that contains html.
How would I htmlentity the string so that everything except tags are encoded?
For example:
$foo = '<div class="link">Here\'s is a link: "<a href="http://www.example.com">Doors & windows</a>'</div>';
I want to convert it to
$out = '<div class="link">Here\'s is a link: "<a href="http://www.example.com">Doors & windows</a>"</div>';
This code snippet shows a function that will load some xml (ensure that at least tags opened have a closing pendant and such, otherwise you will see / read some errors) and then applies
htmlentitiesonto all text-nodes. I actually have no real clue for what you need that, but probably it makes you happy:output: