Generating a JavaScript array from a PHP array
<p>Suppose that I have a string <code>$var</code>:</p>

<pre><code>//php code

$var = "hello,world,test";
$exp = explode(",",$var);
</code></pre>

<p>Now I get the array as <code>exp[0],exp[1],exp[1]</code> as <code>'hello'</code>, <code>'world'</code> and <code>'test'</code>, respectively.</p>

<p>I want to use this all value in javascript in this:</p>

<pre><code>var name = ['hello','world','test'];
</code></pre>

<p>How can I generate that JavaScript in PHP?</p>
