src/Helper/UtilityHelper.php
public function getDistance($lat1, $lgn1, $lat2, $lgn2){
        $earth_radius = 6371;
        $alpha = $lat1 - $lat2;
        $beta = $lgn1 - $lgn2;
        $h = pow((sin(deg2rad($alpha/2))), 2) +  cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * pow(sin(deg2rad($beta/2)),2);
        $dist = 2*$earth_radius*sqrt($h);

        return $dist;
    }
public function getDistance($lat1, $lgn1, $lat2, $lgn2){
        $earth_radius = 6371;
        $alpha = $lat1 - $lat2;
        $beta = $lgn1 - $lgn2;
        $h = pow((sin(deg2rad($alpha/2))), 2) +  cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * pow(sin(deg2rad($beta/2)),2);
        $dist = 2*$earth_radius*sqrt($h);

        return $dist;
    }
public function getDistance ( $ lat1 , $ lgn1 , $ lat2 , $ lgn2 ) { $ earth_radius = 6371 ; $ alpha = $ lat1 - $ lat2 ; $ beta = $ lgn1 - $ lgn2 ; $ h = pow ( ( sin ( deg2rad ( $ alpha / 2 ) ) ) , 2 ) + cos ( deg2rad ( $ lat1 ) ) * cos ( deg2rad ( $ lat2 ) ) * pow ( sin ( deg2rad ( $ beta / 2 ) ) , 2 ) ; $ dist = 2 * $ earth_radius * sqrt ( $ h ) ; return $ dist ; }
Get distance between two lat and lng

@param string $lat1
@param string $lng1
@param string $lat2
@param string $lng2
Get distance between two lat and lng