What are some common syntax errors to watch out for when generating HTML code using PHP?

One common syntax error to watch out for when generating HTML code using PHP is forgetting to properly escape special characters. This can lead to issues such as broken HTML or even security vulnerabilities. To avoid this, always use functions like htmlspecialchars() to escape special characters before outputting them in HTML. Example PHP code snippet:

<?php
$name = "<script>alert('Hello');</script>";
echo htmlspecialchars($name);
?>