title: PHP - header("Location:") inside a function redirects without calling function
body: <p>I'm using a function called <code>headerLocation()</code> in order to redirect properly.
  This is the pertinent part of the function, I'm using it to redirect and then display an appropriate message (personal preference).</p>
  
  <pre><code>function headerLocation($location,$message)
  {
      $_SESSION['output'] = $message;
      header("Location: ". $location);
  }
  </code></pre>
  
  <p>The problem is, when I run the script, the <code>header("Location: ". $location);</code> part is activated without even calling the function (when I initially require it for php parsing).
  This renders the function useless.</p>
  
  <p>Is there any way around this?</p>