How to find out if headers have already been sent in PHP
A lot of programmers struggle to understand the principle behind headers, and how they are supposed to be defined right at the beginning of a page's code. It is no good defining them halfway down the page.
Here then is a function that can serve as a reminder that depending on where they have been defined, the headers might have already been sent. The function in question is:
If the headers have already been sent this function will return TRUE (or 1), while if 0 you will have gotten there in time.
//Define your headers here