What are common issues with PHP code causing extra spaces before the doctype declaration?

Common issues with PHP code causing extra spaces before the doctype declaration are usually related to unintended whitespace characters being output before the doctype declaration. This can be caused by spaces, tabs, or newlines outside of the PHP tags in the file. To solve this issue, ensure that there are no characters being output before the doctype declaration in the PHP file.

<?php
// Start PHP code without any output before the doctype declaration
?>
<!DOCTYPE html>
<html>
<head>
    <title>Example Page</title>
</head>
<body>
    <h1>Hello, World!</h1>
</body>
</html>