Why is it important to include a DOCTYPE declaration in HTML documents, and what are the consequences of omitting it in PHP-generated pages?

Including a DOCTYPE declaration in HTML documents is important because it specifies the version of HTML being used and helps browsers render the page correctly. Omitting the DOCTYPE declaration in PHP-generated pages can lead to compatibility issues, inconsistent rendering across browsers, and potentially broken layouts.

<?php
echo "<!DOCTYPE html>";
echo "<html>";
echo "<head>";
echo "<title>Your Page Title</title>";
echo "</head>";
echo "<body>";
// Your PHP-generated content here
echo "</body>";
echo "</html>";
?>