What is the htmlspecialchars() function?

The php htmlspecialchars() function is used to convert the special characters into html entities. When users are putting the information into the form, you do not want them to add any script to your database. It will security issue for the website. So to avoid that you can use htmlspecialchars() function to convert all the special characters into HTML entities. It replaces the html characters like < and > or ? to the html code. This prevents hacker from injecting any script which can hack your website.

Code:

htmlspecialchars()

Related Posts

Leave a Reply