title: How to put php inside JavaScript?
body: <p><strong>I've tried (but its not working):</strong></p>
  
  <pre><code>&lt;?php  
    $htmlString= 'testing';
  ?&gt;
  &lt;html&gt;
    &lt;body&gt;
      &lt;script type="text/javascript"&gt;  
        var htmlString=&lt;?php echo $htmlString; ?&gt;;
        alert(htmlString);
      &lt;/script&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Here is the <a href="http://web-design.lovetoknow.com/Define_PHP_Variables_Inside_Javascript" rel="noreferrer">tutorial</a> that I've used for that purpose:</p>