I am building application where i am getting the user\'s latitude and longitude using the below code
latitude
longitude
What you're looking for is called the Haversine formula; there's a PHP implementation here.