I have a long string with several special characters, specifically quotes (“, ‘) and greater, less than brackets.. (<, >) and it’s messing up my HTML.
I was wondering if there was a simple way to replace all occurrences of these with their ascii equivalents (> , < , etc) before I spend a bunch of time writing my own function. I’m terrible at RegEx :/
Thanks for your responses.
There are
htmlentities()andhtmlspecialchars()available, depending on what you exactly need. If you only want to break,,<and>, you can do