Forum Moderators: coopster
So, three possibilities
1. You chose a bad example, and you really want to escape quotes and slashes, then the functions mentioned by coopster will help.
2. You want to display HTML as text so that it looks like <b>this</b> and not like this. In that case you want the functions
htmlentities()
htmlspecialchars()
html_entity_decode
3. You think there is a problem with storing HTML in a database and it needs to be escaped. In that case, just relax, no worries. You will need to add slashes as coopster mentioned to escape the quotes, just as you would in any text, but you don't need to escape the HTML per se. So in other words
<html><body>This here is just fine</body></html>
<html><body class="bodyclass">This is a problem</body></html>
As for this line of text with no html, it's a problem too (apostrophe)
And this line has a "problem" of its own (double quotes).