Geocoding an address using Google Maps PHP API

Geocoding address means finding Latitude and Longitude for physical address. This uses Google Maps PHP API.

E.g. Let’s assume we need to plot some events happening in various locations on Google Maps

Geocoding all events to find their latitude and longitude using below function

If the address provided is in a way google can understand, the above function returns $data_arr in array format where

latitude => $data_arr[0]

longitude => $data_arr[1]