PHP Classes

File: ex1.php

Recommend this page to a friend!
  Classes of Mike Frank   Zip/Postal Code Lookup Class   ex1.php   Download  
File: ex1.php
Role: Example script
Content type: text/plain
Description: Example 1 - Lookup zip/postal
Class: Zip/Postal Code Lookup Class
Retrieve geographical location for given zip codes
Author: By
Last change:
Date: 15 years ago
Size: 282 bytes
 

Contents

Class file image Download
<?php
include 'class.geodata.inc.php';

// Compare the distance between two different zip/postal codes
$x = new EyeGeoData();
$x->query('M5X 1J2');

$y = new EyeGeoData();
$y->query('90210');

echo
$x->calcDistance($y, EyeGeoData::KMS, 2) . ' kms'; // prints "6923.05 kms"