title: "Unexpected token <" when using <?php in a Javascript file
body: <p>Being new to this, I'm trying to pass a variable from PHP to Javascript.</p>
  
  <p>In my php page, I use a test variable:</p>
  
  <pre><code>    $testval = "x";
  </code></pre>
  
  <p>In my .js file:</p>
  
  <pre><code>     var exarr = &lt;?php echo json_encode($testval); ?&gt;;
  </code></pre>
  
  <p>I've tried several things, but it seems I always get Unexpected token &lt; when I include "
  
  <p>What am I doing wrong ?</p>
  
  <p>Thanks !</p>