Advertisement
rAthus

PHP fonction distance() entre deux points à vol d'oiseau

Jun 29th, 2016
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /** Retourne la distance en mètre entre 2 points selon leurs latitudes et longitudes **/
  2. function distance($lat1, $lon1, $lat2, $lon2)
  3. {
  4.     return rad2deg(acos(sin(deg2rad($lat1))*sin(deg2rad($lat2))+cos(deg2rad($lat1))*cos(deg2rad($lat2))*cos(deg2rad($lon1-$lon2))))*111189.577;
  5. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement