Calculate distances in PHP
Here is a very handy function, which calculate the distance from a point A to a point B, using latitudes and longitudes. The function can return the distance in miles, kilometers, or nautical miles.

Usage:

echo distance(32.9697, -96.80322, 29.46786, -98.53506, "k")." kilometers";