PHP echo into javascript = Syntax Error: expected expression, got '<'
<p>Despite a mountain of posts on the subject, I'm having no luck getting embedded php to echo out into a JS variable.  Even stripped down to:</p>

<pre><code>//PHP from app.php
$data = json_encode(5);

//and JS in results.html
var data = &lt;?php echo $data; ?&gt;;
</code></pre>

<p>console.log only produces "SyntaxError: expected expression, got '&lt;'".  With quotes around the 

<p>It seems that the PHP isn't parsing.  As Ed Cottrell points out below, there's a here remains unpopular and unanswered. I ran the test.php created by pemcconnell and that works for me.  He says that suggests "another problem with your JS" but my JS is working just fine otherwise. </p>

<p>So... I throw myself to the wolves.  What stupid thing am I doing?  If anyone can help I will make an altar in their honor, complete with garlands and incense.</p>