Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 154333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:57:37+00:00 2026-05-11T09:57:37+00:00

I found a function in a PHP page that calculates the number of miles

  • 0

I found a function in a PHP page that calculates the number of miles between 2 points, but it’s faulty. It’s supposed to work with google maps, but the difference in distances are ranging from 1.3 to 1.65 times further in google maps(which is more accurate).

Here’s the function:

$M =  69.09 * rad2deg(acos(sin(deg2rad($lat1)) * sin(deg2rad($lat2)) +  cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($lon1 - $lon2)))); 

I find it to be a bit complicated and I don’t know that much about geometry to know wheter or not this is correct.

Can someone with a bit more knowhow take a look at this and see what’s wrong with it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T09:57:38+00:00Added an answer on May 11, 2026 at 9:57 am

    Maybe you are comparing the ‘distance as the crow flies’ (direct line between two points) with driving distance?

    Also, see this post for calculating distance between two points in PHP.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found a php function checkdate() , but strangely enough it only seems to
Working with an undisclosed API, I found a function that can set the number
I found a function on the web that generates all sub-multisets of a set
How to move custom marker to front on google map? I found moveToTop function
I already have a function on my page that produces url from curl. I
i have a php page that contains a table which i want to display
I have inherited some C# code where a PHP page containing the function &decrypt
I had a contact form that submitted to a php page with this content:
Alright, I'm using a page creating class I found as below but when I
I have some code on a php page that gets an image filename strips

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.