Why won't this javascript work?
<p>It's been really frustrating me i have this code:</p>

<pre><code>&lt;script type ="text/javascript"&gt;
scriptAr = new Array(); // initializing the javascript array

&lt;?php

foreach ($docsannlist as $subdocs) 
{
    $lines = $subdocs; // read file values as array in php
    $count = count($subdocs); //this gives the count of array
    //In the below lines we get the values of the php array one by one and update it in the script array.
    foreach ($lines as $line)
    {
        print "scriptAr.push(\"$line\");\n"; // This line updates the script array with new entry
    }
}

?&gt;

document.write(scriptAr);
&lt;/script&gt;
</code></pre>

<p>and for some reason its just not working. Please help!</p>
