Issue i'm facing ; Javascript encode with php variables inside
<p>I seem to be having an issue,
I have a Javascript code,and it contains php variables </p>

<pre><code>&lt;?php   // Database information 
$name="whatever"; 

$mp3 = "Link/to/track/";
echo "
var myPlaylist = [{
    mp3:'mix/4.mp3',
    title:'$name',
}]]; &lt;/script&gt;";
</code></pre>

<p>Upon trying to encode this,I'm able to encode the Javascript part, but it displays my variable names (in this instance $name) instead of the value(whatever)</p>
