dangerous message."; echo htmlspecialchars($message); // Output: This is a <b>dangerous</b> message. ?>
alert('Danger!');"; $url = "http://www.example.com/?name=" . urlencode($name); ?> Click hereIn this example, a link is created with a parameter that contains a script tag. To prevent the script from being executed, the `$name` variable is first encoded using the `urlencode()` function. The entire URL is then escaped using `htmlspecialchars()` before being inserted into the href attribute of the link. Overall, these examples demonstrate the importance of escaping HTML characters to prevent security vulnerabilities.