PHP Manual
Prev |  | Next

# headers_sent

(PHP 3>= 3.0.8, PHP 4 )

headers_sent -- Returns `TRUE` if headers have been sent

## Description

bool headers_sent ( string &file [, int &line])

This function returns `TRUE` if the HTTP headers have already been sent, `FALSE` otherwise. You can't add any more header lines using the header() function once the header block has already been sent. Using this function you can at least prevent getting the "Duplicate headers ..." error messages.

The function will return the php source file and line number where output started in the optional `file` and `line` parameters if these are given.

> Note: `file` and `line` where added for PHP 4.3.0.

See also header() for a more detailed discussion of the matters involved.

Prev | Home | Next
header | Up | setcookie