title: PHP string to JavaScript
body: <p>I am trying to copy the string </p>
  
  <pre><code> $str = '
           this
           is
           my
           string';
  </code></pre>
  
  <p>to a JavaScript variable like so</p>
  
  <pre><code> var str1 = '&lt;?php echo $str ?&gt;';
  </code></pre>
  
  <p>but when I do, I get an error </p>
  
  <pre><code>Uncaught SyntaxError: Unexpected token ILLEGAL
  </code></pre>
  
  <p>If you are asking yourself why I'm doing this,
  I create a <code>&lt;table&gt;</code> with PHP and insert it to the <code>$str</code> variable and want to later use it in a JavaScript function.</p>