Header order of execution / evaluation
<p>When you push submit it would seem like it should evaluate the header in foo() before the next one, but the next one gets executed first?</p>

<pre><code>&lt;?php

    function foo(){
        header("Location: http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."?message=XYZ");
    }

    if($_POST['action'] == 'gogogo'){
        foo();
        header("Location: http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."?message=ABC");
    }

    echo "&lt;form action='".$_SERVER['SCRIPT_NAME']."' method='post'&gt;";
    echo "&lt;input type='hidden' name='action' value='gogogo' /&gt;";
    echo "&lt;input type='submit' /&gt;";
    echo "&lt;/form&gt;";

    echo "Contents of \$_GET['message']: ";
    if(isset($_GET['message'])) {
        echo $_GET['message'];
    } else {
        echo "Empty";
    }

?&gt;
</code></pre>
