Follow the steps to do it yourselfStep 1:
We read a file "im.txt" as array. The file will be read in such a way that each line will be a value in array. So if we have 10 lines in "im.txt" we will have the array length as 10.
$file = "im.txt";
$lines = file($file); // read file values as array in php
$count = count($lines); //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_num => $line)
print "scriptAr.push(\"$line\" );"; // This line updates the script array with new entry