PHP code example of sahinersever / distance-coordinates
1. Go to this page and download the library: Download sahinersever/distance-coordinates library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sahinersever / distance-coordinates example snippets
use CalcCoordinate\Coordinate\{Distance};
$Distance = new Distance();
$lat1 = 41.01408;
$lon1 = 28.63621;
$lat2 = 41.01287;
$lon2 = 29.23321;
echo $Distance->distance($lat1,$lon1,$lat2,$lon2)->km();
echo $Distance->distance($lat1,$lon1,$lat2,$lon2)->mile();
echo $Distance->distance($lat1,$lon1,$lat2,$lon2)->meter();