It depends on your output_buffering directive in the php.ini . If it's Off
output_buffering = Off
then echo headers_sent() should output 1
In other cases, headers_sent() will not output any results, because it will be FALSE. Headers will not be sent because the output is buffered.
If you want to get around this and force the sending of headers, you can use flush() .
Hope this helps!
source share