Problem Statement
What is the main purpose of escaping output in PHP?
Explanation
Escaping output ensures user input is shown as plain text instead of executable HTML or JavaScript. This prevents Cross-Site Scripting attacks.
Code Solution
SolutionRead Only
echo htmlspecialchars($input, ENT_QUOTES);
Practice Sets
This question appears in the following practice sets:
