How can PHP be used to prevent the execution of HTML and PHP on a forum board?

To prevent the execution of HTML and PHP on a forum board, you can use the `htmlspecialchars()` function in PHP. This function will convert special characters to their HTML entities, preventing any code from being executed on the forum board.

$text = "<script>alert('Hello!');</script>";
$filtered_text = htmlspecialchars($text);
echo $filtered_text;