title: PHP output in a JavaScript expression
body: <p>Please consider the following scenario with a simple HTML document and a JavaScript loaded in it:</p>
  
  <pre><code>&lt;!-- doc.html --&gt;
  &lt;!doctype html&gt;
  &lt;html lang="en"&gt;
      &lt;head&gt;        
          &lt;script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"&gt;&lt;/script&gt;
          &lt;script type="text/javascript" src="script.js"&gt;&lt;/script&gt;
      &lt;/head&gt;
  &lt;/html&gt;
  
  // script.js
  window.onload = function()
  {
      var d = new Date();
      d.setHours(&lt;?php echo(date("H")); ?&gt;);
  }
  </code></pre>
  
  <p>It's really Quite simple, isn't it?
  However, while this coode works perfectly for getting the current hour (which will be returned as an <code>INT</code>), it doesn't if I try to receive a more complex date/time format like the one below:</p>
  
  <pre><code>var serverTime = &lt;?php echo date("Y-m-d H:i:s"); ?&gt;;
  </code></pre>
  
  <p>This should encode to <code>1900-01-01 00:00:00</code>. So, cause this is not a legal expression I want to encapsulate the result with quotes:</p>
  
  <pre><code>var serverTime = "&lt;?php echo date("Y-m-d H:i:s"); ?&gt;";
  </code></pre>
  
  <p>At a first glance this should work. Unfortunately, it doesn't. <code>serverTime</code> contains just an empty string.</p>
  
  <p>What am I doing wrong?</p>