<?php $key = fopen("auctions/key.txt", 'r'); $name = array(); $date = array(); $a = 0; echo '<script>time = {};</script>'; while (!feof($key)) { array_push($name, fgets($key)); array_push($date, fgets($key)); fgets($key); //skip blank line $a_date = $date[$a]; echo "<script> var = $a_date; time.push(a); </script>"; $a++; } fclose($key); ?>
the purpose of code assign javascript information used later based on file saved in server's files (key.txt). however, when echo out set variables, (specifically @ var = $a_date
) chrome says uncaught syntaxerror: unexpected number. causing this? know var = $a_date
part, when comment out, error not thrown.