What are the potential consequences of not following the correct order of header instructions and output in PHP?

If the correct order of header instructions and output is not followed in PHP, it can lead to errors such as "headers already sent" or unexpected output being sent to the browser before headers are set. To solve this issue, make sure to set any header instructions before sending any output to the browser.

<?php
// Correct order of header instructions and output
header("Content-Type: text/html");
echo "Hello, World!";
?>