This is equivalent to calling the PHP function flush() after each and every call to print() or echo() and each and every HTML block.
?php ob_start(); echo "Bonjour\n"; setcookie ("nom_du_cookie", "valeur_du_cookie"); ob_end_flush();?