Test and contrast these two examples:
<?php
echo "Hello World!";
header("Location: http://example.com");
?>
<?php
header("Location: http://example.com");
echo "Hello World!";
?>
Of course, more realistically you would not be using HTTP 302 re-direction, but say you will be setting a cookie.