title: PHP if-statement ignored when header(Location: xxx) is inside
body: <p>I have a strange problem. There is an if-statement at the top of my page that seems to be ignored when a header(location: xxx) commmand is inside of it. </p>
  
  <pre><code>$check = $authorisation-&gt;check(); 
  // i know this results in true by echoing the value 
  // (you've got to believe me on this one)
  
  if(!$check){
      // redirect to message
      header("Location: message.php");
      exit;
  
  }else{
      // do nothing, continue with page
  }
  </code></pre>
  
  <p>This ALWAYS redirects to the message.php page, no matter what the outcome of $authorisation->check() is!</p>
  
  <p>Strange thing is, when I comment out the header-command, and put echo's in the if-statement for verification, all works as to be expected:</p>
  
  <pre><code>    $check = $authorisation-&gt;check(); // true
      if(!$check){
          // redirect to message
          echo "you are not welcome here";
      }else{
          echo "you may enter";
      }
  </code></pre>
  
  <p>The result is "you may enter";</p>
  
  <p>This also works as expected:</p>
  
  <pre><code>    $check = true;
      if(!$check){
          // redirect to message
          header("Location: message.php");
          exit;
  
      }else{
          // do nothing
      }
  </code></pre>
  
  <p>This only redirects to the message page when $check = false;</p>
  
  <p>Last funny thing is that I experience the problem only on 1 server, same script works flawlessly on testserver.</p>
  
  <p>Any help would be much appreciated!</p>