, script .
javascript, .
, - :
<script type="text/javascript">
var coords = new Array(2);
coords[0] = new Array(2);
coords[0][0] = 123.45;
coords[0][1] = 987.65;
coords[1] = new Array(2);
coords[1][0] = 234.56;
coords[1][1] = 876.54;
</script>
, .
( ) , , javascript. :
<script type="text/javascript">
var coords = [[123.45,987.65],[234.56,876.54]];
</script>
so in your loop inside php you will create a string that will eventually contain var coords = [[123.45,987.65],[234.56,876.54]]. Outside of your loop, you wrap it in script blocks and output it to the page.
source
share