Conversion tables A-K
  Conversion tables L-Z
  SPAM database query
  Reverse WHOIS utility
  North America area codes
  PHP Example forums

PHP example repository.

Web www.web-max.ca
Back to examples
Calculate distance between 2 sets of longitude / latitude coordinates.

Takes two sets of coordinates in decimal longitude and latitude format and returns the distance in kilometers.

<?php

$lat1 
46.2341938036161
$lon1 = -63.124778021257015

$lat2 46.4141938036161
$lon2 = -63.118571124705284

$distance = (3958*3.1415926*sqrt(($lat2-$lat1)*($lat2-$lat1) + cos($lat2/57.29578)*cos($lat1/57.29578)*($lon2-$lon1)*($lon2-$lon1))/180);

print(
$distance);

?>
 
Example
Downloads

 misc_2.zip