Ref: https://www.codeofaninja.com/2014/06/google-maps-geocoding-example-php.html
https://support.google.com/maps/answer/18539?co=GENIE.Platform%3DDesktop&hl=en
<?php /**
* Function to return latitude and longitude from Google map Url
* @param type $url
* @return array
*/
function get_latlng_from_map_url($url = '') {
// $url = 'https://www.google.co.in/maps/place/Wingify/@28.6907742,77.1508266,21z/data=!4m8!1m2!2m1!1s14th+floor+KLJ+Tower,++Netaji+Subhash+Place,+Wazirpur,+Delhi,+110034!3m4!1s0x390d0234852fffff:0xdf6a1081fe66751!8m2!3d28.6907578!4d77.1508082?hl=en&authuser=0';
//$url = 'https://maps.google.com/maps?ll=43.6474528,-79.3799409,&z=16&t=m&hl=en-US&gl=US&mapclient=apiv3';
//$url = 'https://www.google.ca/maps/@43.6474528,-79.3799409,14.78z';
$lat_lng = array();
if (!empty($url)) {
preg_match('/[ll=|@](-?[\d\.]*)\,([-?\d\.]*)/', $url, $match);
if (isset($match['1']) && !empty($match['1']) && isset($match[2]) && !empty($match['2'] )) {
$lat_lng['lat'] = $match[1];
$lat_lng['lng'] = $match[2];
}
}
return $lat_lng;
}