PHP Classes

File: tests/distanceMeter.php

Recommend this page to a friend!
  Classes of Ali YILMAZ   Mind Framework   tests/distanceMeter.php   Download  
File: tests/distanceMeter.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Mind Framework
Framework that implements several design patterns
Author: By
Last change:
Date: 2 years ago
Size: 1,565 bytes
 

Contents

Class file image Download
<?php

require_once '../src/Mind.php';

$Mind = new Mind();

/* These are two points in Turkey */
$point1 = array('lat' => 41.008610, 'long' => 28.971111); // Istanbul
$point2 = array('lat' => 39.925018, 'long' => 32.836956); // Anitkabir


//Array
//(
// [m] => 4188.59
// [km] => 4.19
// [mi] => 2.6
// [ft] => 13742.1
// [yd] => 4580.64
//)
$distance = $Mind->distanceMeter($point1['lat'], $point1['long'], $point2['lat'], $point2['long']);
echo
'<pre>';
print_r($distance);
echo
'</pre>';

//4188.59
$distance = $Mind->distanceMeter($point1['lat'], $point1['long'], $point2['lat'], $point2['long'], 'm');
echo
$distance;

echo
'<br>';
//4188.59
$distance = $Mind->distanceMeter($point1['lat'], $point1['long'], $point2['lat'], $point2['long'], array('m'));
echo
$distance;

//Array
//(
// [m] => 4188.59
// [km] => 4.19
//)
$distance = $Mind->distanceMeter($point1['lat'], $point1['long'], $point2['lat'], $point2['long'], array('m', 'km'));
echo
'<pre>';
print_r($distance);
echo
'</pre>';

//Array
//(
// [m] => 4188.59
// [km] => 4.19
// [mi] => 2.6
// [ft] => 13742.1
// [yd] => 4580.64
//)
$distance = $Mind->distanceMeter($point1['lat'], $point1['long'], $point2['lat'], $point2['long'], array());
echo
'<pre>';
print_r($distance);
echo
'</pre>';

//Array
//(
// [m] => 4188.59
// [km] => 4.19
// [mi] => 2.6
// [ft] => 13742.1
// [yd] => 4580.64
//)
$distance = $Mind->distanceMeter($point1['lat'], $point1['long'], $point2['lat'], $point2['long'], '');
echo
'<pre>';
print_r($distance);
echo
'</pre>';