Escaping Output
htmlspecialchars stops XSS by turning < and > into entities. Escape on output.
Example
echo htmlspecialchars("<script>alert(1)</script>");Result
<script>alert(1)</script>
Exercise
Escape HTML.
($s)Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.