I am trying to grab coordinates from an array to add to a Google map to output my polygons.
And I am running into some difficulty in trying to echo out my array ($ArrayCoords) as a string to store into a variable.
I have this array which consist of multiple lat and lng coordinates as well as a zoom:
$ArrayCoords = get_field('Array_Coords');
print_r($ArrayCoords);
/* Print out as:
[draw_map] => Array
(
[coords] => Array
(
[0] => Array
(
[lat] => 38.928713698662
[lng] => -94.537423253059
)
[1] => Array
(
[lat] => 38.927679421508
[lng] => -94.537782669067
)
[2] => Array
(
[lat] => 38.928038315258
[lng] => -94.53973531723
)
[3] => Array
(
[lat] => 38.928171856655
[lng] => -94.54069018364
)
[4] => Array
(
[lat] => 38.928215341202
[lng] => -94.541194438934
)
[5] => Array
(
[lat] => 38.929258624074
[lng] => -94.541215896606
)
)
[zoom] => 13
)
*/
I am trying to turn this array to store into a variables ($latLngCoords and $Zoom) which will echo as:
echo $latLngCoords;
/*
38.928713698662, -94.537423253059
38.927679421508, -94.537782669067
....and so on..
*/
echo $Zoom;
// 13
I am not sure how to do this.