As mentioned in PHP Manual:
Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP
The output of the following code redirects to the given url without any error.Couldn't find why this didn't conform to the PHP Manual lines above.
<html>
<body>
<div>
some error
</div>
</body>
</html>
<?php
header('Location: http://google.com/');
?>