PHP code example of djtommek / coordinates

1. Go to this page and download the library: Download djtommek/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/ */

    

djtommek / coordinates example snippets



$prague = new \DJTommek\Coordinates\Coordinates(50.0875, 14.4213);
printf('Prague: %s', $prague); // Prague: 50.087500,14.421300

$berlin = new \DJTommek\Coordinates\CoordinatesImmutable(52.518611, 13.408333);
$distance = $prague->distance($berlin);

printf('Distance between Prague and Berlin is %d km', $distance / 1000);
// 'Distance between Prague and Berlin is 279 km'