I have a javascript for a usage graph , the data for the graph within the javascript is defined as follow:
data: [1,2,3,4,5,6],
I have before the javascript a foreach and a value that im trying to use in this data field as follow :
data: [],
Now if i just do echo "$test"; outside javascript on the page i get the following output 1,2,3,4,5,6, which is correct , if i copy this output and use it directly in the datafield it works BUT when I try to call the $test value within the datafield it does not work. So in short
data: [1,2,3,4,5,6], (WORKS)
data: [<?php echo "$test"; ?>], (does not work even though when doing normal echo outside java it does print 1,2,3,4,5,6
Any help would be appreciated
foreach ($chart->usage->days->day as $day):
$totals = $day->total;
$datau = Round(("$totals") / (1024 * 1024 * 1024), 2);
$test = "$datau, ";
[1,2,3,4,5,6]isn't the same of["1,2,3,4,5,6"]