## Calculating distance between zip codes in PHP

This is mike’s answer with some annotations for the magic numbers. It seemed to work fine for me for some test data: function calc_distance($point1, $point2) { $radius = 3958; // Earth’s radius (miles) $deg_per_rad = 57.29578; // Number of degrees/radian (for conversion) $distance = ($radius * pi() * sqrt( ($point1[‘lat’] – $point2[‘lat’]) * ($point1[‘lat’] – … Read more