Escape HTML

Escape HTML special characters to prevent XSS attacks and ensure safe rendering.

Code

Utilities
htmlspecialchars($str, ENT_QUOTES, 'UTF-8');

Parameters

The string containing HTML to escape.

Server

More PHP Snippets