Easy Tutorial
❮ Func Math Acos Func Directory Scandir ❯

PHP headers_sent() Function



Definition and Usage

The headers_sent() function checks if HTTP headers have been sent/where they have been sent.

If headers have been sent, the function returns TRUE; otherwise, it returns FALSE.

Syntax

Parameter Description
file, line Optional. If the file and line parameters are set, headers_sent() will store the PHP source file name and line number where the output started into the file and line variables.

Tips and Notes

Note: Once the header block has been sent, you cannot send additional headers using the header() function.

Note: The optional file and line parameters were added in PHP 4.3.


Example 1


Example 2

Using the optional file and line parameters:


❮ Func Math Acos Func Directory Scandir ❯