What are the potential consequences of including a file before setting a cookie in PHP?

Including a file before setting a cookie in PHP can lead to headers already being sent, which will cause the cookie to not be set properly. To solve this issue, make sure to set the cookie before including any files or outputting any content.

<?php
// Set the cookie first
setcookie("user", "John Doe", time() + 3600, "/");
// Include the file after setting the cookie
include 'myfile.php';
?>