Skip to content

Instantly share code, notes, and snippets.

View Cutta's full-sized avatar
🏃‍♂️
null

Cüneyt Çarıkçi Cutta

🏃‍♂️
null
View GitHub Profile
@adrienne
adrienne / gist:3180103
Created July 26, 2012 03:38
Haversine formula (PHP/MySQL)
/**
* Generates the string for the Haversine function. We assume that the `zipcode`, `latitude`,
* and `longitude` columns are named accordingly. We are also not doing much error-checking
* here; this is a simple text cruncher to make things prettier.
* We may also be integrating some extra SQL in, passed in via the $extra parameter
*
* @param string $table The table to search in
* @param float $lat The latitude part of the reference coordinates
* @param float $lng The longitude part of the reference coordinates
* @param int $radius The radius to search within