Compute distance between GPS coordinates Compute distance between GPS coordinates

How to compute distance between 2 GPS points?

In one of my projects I was looking for simple way how to compute direct distance between 2 arbitrary airports in the world. Simply, I was looking for a way to measure distance between 2 GPS points. Naturally there exist several ways how to compute such thing. After research I found that many people use algorithms derived from Great circle distance method [wiki].

Here is a PHP code:

There are 2 simple corrections how to simplifie this algorithm more. First by padding all the sub-results into one big equation. And second, by ensuring the the input units will be always the same (using numbers instead of Strings) strtoupper() function can be removed.