发送标头后设置cookie。 它为什么有效? 它不应该

This code shouldn't work, because the cookie data should sent with the headres, before any other output.

<html>
<body>
text before setcookie
<?php

setcookie( "meaningoflife", "42", time()+42000 );
?>
</body>
</html>

But why I get the php from a browser, it will be set. Why ? My PHP version is 5.3.6, apache 2.2.20 on a Mac OS X machine.

as @mario said:

You probably have output buffering enabled. Check with ini_get("output_buffering").