I grabbed a database of the zip codes and their langitudes/latitudes, etc from this This page. It has got the following fields:
ZIP, LATITUDE, LONGIT
It can be done with just maths...
function calc_distance($point1, $point2)
{
$distance = (3958 * 3.1415926 * sqrt(
($point1['lat'] - $point2['lat'])
* ($point1['lat'] - $point2['lat'])
+ cos($point1['lat'] / 57.29578)
* cos($point2['lat'] / 57.29578)
* ($point1['long'] - $point2['long'])
* ($point1['long'] - $point2['long'])
) / 180);
return $distance;
}