when to use htmlspecialchars() function?

You should only call this method when echoing the data into HTML.

Don’t store escaped HTML in your database; it will just make queries more annoying.
The database should store your actual data, not its HTML representation.

Leave a Comment