PHP 8 · Web, security and database

Escape output

Escape user-provided values before printing them in HTML, to prevent cross-site scripting.

echo htmlspecialchars($input, ENT_QUOTES, 'UTF-8');

Official PHP 8 documentation

More web, security and database commands

All web, security and database commands · PHP 8 cheatsheet

Was this page helpful?