Created
August 24, 2011 21:06
-
-
Save ruthlessfish/1169240 to your computer and use it in GitHub Desktop.
haversine formula for MySQL in PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function haversine($lat1, $long1, $lat2, $long2) | |
{ | |
return "(3959 * acos(cos(radians($lat1)) * cos(radians($lat2)) * cos(radians($long2) - radians($long1)) + sin(radians($lat1)) * sin(radians($lat2))))"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment