Protect HTML output when rendering user-controlled text.
<?php function escapeHtml(string $value): string { return htmlspecialchars( $value, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8' ); } echo escapeHtml($userInput);