What are the potential consequences of outputting content before calling setcookie() in PHP?

Outputting content before calling setcookie() in PHP can result in the headers already being sent to the browser, which will cause the setcookie() function to fail. To prevent this issue, make sure to call setcookie() before any content is outputted to the browser.

<?php
// Call setcookie() before any content is outputted
setcookie('cookie_name', 'cookie_value', time() + 3600, '/');
?>