What potential issue arises when including PHP files before the doctype declaration in a web page?

Including PHP files before the doctype declaration in a web page can cause headers to be sent prematurely, leading to errors such as "Cannot modify header information." To solve this issue, ensure that no output is sent to the browser before sending headers, which includes the doctype declaration. This can be achieved by moving all PHP code, including includes and requires, to the top of the file before any HTML content.

<?php
ob_start(); // Start output buffering
include 'header.php'; // Include PHP files before any output
?>
<!DOCTYPE html>
<html>
<head>
    <title>My Web Page</title>
</head>
<body>
    <!-- HTML content here -->
</body>
</html>
<?php
include 'footer.php'; // Include PHP files at the end
ob_end_flush(); // Flush output buffer
?>