Hi people
I need your help with this code. I'm stuck. This sample file developers.google.com/maps/documentation/javascri…
has a Javascript locations array var locations = [...];
I have tried the following code to replace the Javascript array in vain with PHP.
What am I doing wrong?
$strmarkers[0] = array("lat: -1.275292" => 'lng: 36.812072'); $strmarkers[1] = array("lat: -1.282243" => 'lng: 36.815677'); $strmarkers[2] = array("lat: -1.273801" => 'lng: 36.825859');
...
var mynewlocations = [ <?php echo json_encode($strmarkers); ?> ]
Job Nyamolo
Senior Developer
I got a solution
$strmarkers[0] = array( 'lat' => -1.275292, 'lng' => 36.812072 ); $strmarkers[1] = array( 'lat' => -1.282243, 'lng' => 36.815677 );
$strmarkers[2] = array( 'lat' => -1.273801, 'lng' => 36.825859 );
?>
var mynewlocations = <?php echo json_encode($strmarkers, JSON_NUMERIC_CHECK); ?>