What role does the include() function play in PHP scripts and how can it impact the order of header instructions and output?

The include() function in PHP is used to include and evaluate the specified file during the execution of the script. When using include(), it's important to consider the order of header instructions and output, as including a file with header instructions after output has already been sent can cause errors. To avoid this issue, it's recommended to include files with header instructions at the beginning of the script.

<?php
include('header.php');

// Rest of the PHP script
?>