title: Looping google maps markers with json encoded array
body: <p>Really need help here. I convert an array with json_encode to be able to loop through the lats/longs of the searchresult in a google map below. The map loads fine if i just use a normal marker, and if I echo the json encoded array I get:</p>
  
  <pre><code>["55.7171, 13.2354","55.6411, 13.2122"]
  </code></pre>
  
  <p>The Php code below (ignore most of it except the markers part, just giving you an idea of how it´s used).</p>
  
  <pre><code>&lt;?php
      if (isset($search_result)) {
  
          $markers = array();
  
          // Looping through the results and displaying appropriate data.
          foreach ($search_result as $result) {
              ?&gt;
              &lt;li&gt;&lt;?= $result['first_name']; ?&gt;&lt;/li&gt;
              &lt;li&gt;&lt;?= $result['last_name']; ?&gt;&lt;/li&gt;
              &lt;li&gt;&lt;?= $result['address']; ?&gt;&lt;/li&gt;
              &lt;li&gt;&lt;img width="80" height="80" src="&lt;?php echo file_exists($result['profile_picture'])? $result['profile_picture'] : $img_profile_def; ?&gt;"&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href="profile.php?userid=&lt;?= $result['id']; ?&gt;"&gt;View This User&lt;/a&gt;&lt;/li&gt;&lt;br&gt;&lt;br&gt;
      &lt;?php
          $markers[] = $result['latitude'] . ', ' . $result['longitude'];
          }
      }
  ?&gt;
  </code></pre>
  
  <p>The Javascript at the bottom of the script initializing the map etc. I get a map with this code but no markers.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function initialize() {
      var markers = &lt;?php echo json_encode($markers); ?&gt;;
  
      var myLatLng = new google.maps.LatLng( &lt;?php echo $area_coords; ?&gt; );
  
      var mapOptions = {
          center:myLatLng,
          zoom:15,
          mapTypeId:google.maps.MapTypeId.ROADMAP
      };
      var map = new google.maps.Map(document.getElementById("map_canvas"),
              mapOptions);
  
      for (i = 0; i &lt; markers.length; i++) {
  
      var position = new google.maps.LatLng(markers[i]);
  
      var marker = new google.maps.Marker({
  
          map:map,
          position:position
  
      });
      }
  }
  
  initialize();
  </code></pre>
  
  <p></p>