tags:

views:

67

answers:

5
  1. after all stuff behind is run
  2. immediately

Which is the case? Can anyone verify this?

A: 

depends on the output_buffering setting
headers_sent() function can verify

Col. Shrapnel
A: 

If output buffering is disabled then it will be sent immediately. It must be sent before any other content (however you can perform processing logic before sending the header)

Dolbz
Does PHP disable ob by default?
I believe so in most configurations. Of course this depends on your host. You can force output buffering by calling ob_start() before outputting anything and ob_end_flush() when you've output everything.
Dolbz
A: 

Depends on output buffering, but the PHP interpreter still only uses them after having interpreted all the code before, just like a normal function. Still, there must not be any HTML before a header(), or things will screw up.

Javier Badia
+1  A: 

Refer the following link.

http://php.net/manual/en/function.header.php

rekha_sri
+1  A: 

To make sure that a page is directly redirected, add a exit; after the header.

kevinverhoef