Location: PHPKode > scripts > Zip/Postal Code Lookup Class > ex2.php
<?php
include 'class.geodata.inc.php';

$lookup = new EyeGeoData();

// Lookup postal code M5X 1J2
print_r($lookup->query('M5X 1J2'));
/*Array
(
    [PostalCode] => M5X1J2
    [City] => TORONTO
    [Province] => ON
    [Country] => CA
    [AreaCode] => 416
    [TimeZone] => 5
    [Coordinates] => Array
        (
            [Latitude] => 43.648306
            [Longitude] => -79.38224
        )

)*/
 
// Lookup zip code 90210
print_r($lookup->query('90210'));
/*Array
(
    [PostalCode] => 90210
    [City] => BEVERLY HILLS
    [Province] => CA
    [Country] => US
    [AreaCode] => 310
    [TimeZone] => 8
    [Coordinates] => Array
        (
            [Latitude] => 34.103131
            [Longitude] => -118.416253
        )

)*/
Return current item: Zip/Postal Code Lookup Class