Consider strip_tags()
.
strip_tags("<b>TEXT</b>");
Output:
TEXT
But what if i want to nullify the effect of the tags but display them as well?
Output:
<b>TEXT</b>
Would i have to use preg_replace()
? Or is there a more elegant solution available?
Thanks :D
You can HTML encode the string via htmlspecialchars:
htmlspecialchars("<b>TEXT</b>");