title: Inject into head section of html page using PHP
body: <p>Anytime I <code>echo</code> something out in PHP, no matter where the PHP code sits it puts the generated code into the <code>body</code> tag of the html page.</p>
  
  <p><strong>How do I inject html created by PHP into the <code>head</code> tag of the HTML?</strong></p>
  
  <p>for example making the title dynamic or writing a script within the head dynamic.</p>
  
  <p>example code:</p>
  
  <pre><code>&lt;html&gt;
    &lt;head&gt;
      &lt;?php echo "moo"; ?&gt;
    &lt;/head&gt;
    &lt;body&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>returns:</p>
  
  <pre><code>&lt;html&gt;
    &lt;head&gt;
    &lt;/head&gt;
    &lt;body&gt;
      moo
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I am running it through the server running Nagios this might have something to do with it.</p>