-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathziptest.php
42 lines (33 loc) · 1.45 KB
/
ziptest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | Filname: |
// +----------------------------------------------------------------------+
// | Copyright (c) http://www.sanisoft.com |
// +----------------------------------------------------------------------+
// | Description: |
// +----------------------------------------------------------------------+
// | Authors: Original Author <author@example.com> |
// | Your Name <you@example.com> |
// +----------------------------------------------------------------------+
//
// $Id$
include_once ("phpZipLocator.php");
$host = 'localhost';
$dbname = 'phpZipLocator';
$username = '';
$password = '';
$dsn = "mysql:host=$host;dbname=$dbname";
$options = array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
);
$db = new PDO($dsn, $username, $password, $options);
$zipLoc = new zipLocator;
$zipOne = 12345;
$zipTwo = 23456;
$distance = $zipLoc->distance($zipOne,$zipTwo);
echo "The distance between $zipOne and $zipTwo is $distance Miles<br>";
$radius = 20;
$zipArray = $zipLoc->inradius($zipOne,$radius);
echo "There are ",count($zipArray)." Zip codes within $radius Miles of $zipOne";
?>