We use the following: http://www.phpclasses.org/browse/package/522.html

However, it doesnt return the distance that the zip is from the input zip code.

It uses this calculation/query:
$query="SELECT zipcode FROM pmd_zipdata WHERE (POW((69.1*(lon-\"$lon\")*cos($lat/57.3)),\"2\")+POW((69.1*(lat-\"$lat\")),\"2\"))<($radius*$radius) "

Anyway to get it to return also the distance?