What is the easiest way to Html encode in PHP?
By encode, do you mean: Convert all applicable characters to HTML entities?
htmlspecialchars
or
htmlentities
You can also use strip_tags if you want to remove all HTML tags :
Note: this will NOT stop all XSS attacks