The following would be legal:
<?php
$var = "hello";
header("Location: somewhere.html");
?>
But the following is not:
<?php
$var = "hello";
echo = $var." , steve m";
header("Location: somewhere.html");
?>
I hope that explained it clearly. No messages can be sent to the browser before your header call. You could do example 2 if you used output buffering, however:
<?php
ob_start();
$var = "hello";
echo = $var." , steve m";
header("Location: somewhere.html");
?>
However, the echo statement in example 3 still wouldn't show because the echo statement would be suppressed until the end of the script, but you would have been redirected to somewhere.html before that happened anyway.