title: Write to javascript array within php loop
body: <p>I have a php loop that is echoing out geolocation values. How can I get it to write those values to a javascript array, so I can then use them to plot points on an HTML5 canvas?</p>
  
  <p>The php loop is as follows</p>
  
  <pre><code>&lt;ul id = "geo-list"&gt;
      &lt;?php foreach($data as $phrase) { ?&gt;
          &lt;li&gt;&lt;?php
              if ($phrase-&gt;geo != false) {
                  echo " | From (";
                  echo $phrase-&gt;geo-&gt;coordinates[0];
                  echo ",";
                  echo $phrase-&gt;geo-&gt;coordinates[1];
                  echo ")";
              } else {
                  echo " | No Location Data";
              }
          ?&gt;
          &lt;/li&gt;
      &lt;?php  } ?&gt;
  &lt;/ul&gt;
  </code></pre>