I would like to select a specific line of an object that have been created using json_encode function from a php array.
  while($locations=$req->fetch()){
    $t = $locations->titre;
    $la = $locations->latitude;
    $lo = $locations->longitude;
    $typ = $locations->type;
    $ep = $locations->couleur;
    $matrice[$i] = array($t, $la, $lo, $ep);
    $i=$i+1;
  }var locations = <?php echo json_encode($matrice); ?>;
locations[0] = ['ma position actuelle', 0, 0, 0];
//console.log(Object.keys(locations));
//console.log(locations);
var centerLat=0.0, centerLong=0.0;
for (var i=1; i<Object.keys(locations).length; i++) {
  centerLat+=locations[i][1];
 centerLong+=locations[i][2];
}I would like to select the second and the third element of "locations" but the syntax inside the loop is wrong. Does anyone has an idea. Thank you
 
     
     
    