headers_sent()

It checks whether headers have been sent .

Example

<?php
if (!headers_sent()) {
header(“Location: http://www.phpcodez.com/”);
exit;
}
?>