src/Lootils/Geo/Method/Yee.php
public function distance(LocationInterface $location1, LocationInterface $location2) {
    $radLong1 = deg2rad($location1->longitude());
    $radLat1 = deg2rad($location1->latitude());
    $radLong2 = deg2rad($location2->longitude());
    $radLat2 = deg2rad($location2->latitude());


    $radius = $this->earthRadius(($location1->latitude() + $location2->latitude()) / 2);

    $cosangle = cos($radLat1)*cos($radLat2) *
      (cos($radLong1)*cos($radLong2) + sin($radLong1)*sin($radLong2)) +
      sin($radLat1)*sin($radLat2);

    return acos($cosangle) * $radius;
  }
public function distance(LocationInterface $location1, LocationInterface $location2) {
    $radLong1 = deg2rad($location1->longitude());
    $radLat1 = deg2rad($location1->latitude());
    $radLong2 = deg2rad($location2->longitude());
    $radLat2 = deg2rad($location2->latitude());


    $radius = $this->earthRadius(($location1->latitude() + $location2->latitude()) / 2);

    $cosangle = cos($radLat1)*cos($radLat2) *
      (cos($radLong1)*cos($radLong2) + sin($radLong1)*sin($radLong2)) +
      sin($radLat1)*sin($radLat2);

    return acos($cosangle) * $radius;
  }
Calculate the distance between two locations.

Note, this is an estimate. The further the two places are from each other
the less accurate the distance calculation will be. This method also assumes
all locations are at the equator.