<code><?php echo 'some outputs'; var_dump(setcookie('hello', 'world')); // bool(true)</code>
<code><?php echo 'some outputs'; var_dump(setcookie('hello', 'world')); // bool(true)</code>
It’s mentioned in the manual
Cookies are part of the HTTP headers, so the setcookie() function must be called before other information is output to the browser.
But PHP will enable output_buffering by default