1 Answers
htmlentities is used to convert all applicable characters to HTML entities.It is used to stop the user from running malicious code in HTML.
With use of htmlentities, user can’t run the html tags like h2, p, script etc.
It helps to prevent you fromXSS attack.
echo htmlentities($userData);