PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Vivek moyal   PHP Distance between Two Coordinates   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Example code for using the class
Class: PHP Distance between Two Coordinates
Get locations distance with longitude and latitude
Author: By
Last change:
Date: 8 years ago
Size: 828 bytes
 

Contents

Class file image Download
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php
       
// $lat1= Your latitude, $lon1= Your Longitude, $lat2= Desired Latitude, $lon2= Desired Longitude
        // $unit can be blank too. If you need the results in Miles than leave it blank else.
        // Use K for kilometre and N for Nautical Miles
       
error_reporting(E_ALL & ~E_NOTICE & ~E_USER_NOTICE);
        include_once
'./calculateDistance.php';
       
$distanceClass=new calculateDistance();
       
$distanceClass->calculate($lat1, $lon1, $lat2, $lon2, $unit);
       
       
//For testing purpose uncomment the below line
       
echo $distanceClass->calculate("26.896623", "75.745167", "26.894555", "75.742460", "K");
   
       
?>
</body>
</html>