SyntaxFix
Write A Post
Hire A Developer
Questions
In addition to the good answers above, PHP also has a built-in filter function that is quite useful: filter-var.
To remove HMTL characters, use:
$cleanString = filter_var($dirtyString, FILTER_SANITIZE_STRING);
More info: