Q. Which PHP function can be used to safely output user input to prevent XSS attacks?
β
Correct Answer: (A)
htmlspecialchars()
Explanation: htmlspecialchars() converts special characters to HTML entities to prevent XSS.