Imagine you're building a feedback form where users can submit comments. To prevent potential script injections, which PHP function would you use to process the comment text before displaying it back to other users or saving it to a database?

  • htmlentities()
  • urlencode()
  • strip_tags()
  • base64_encode()
The htmlentities() function is used to convert potentially harmful characters in user input to their HTML entities, preventing script injections. It's a security measure to sanitize user-generated content.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *