Functions:addressZipDetailsGet
From Whirlwind eCommerce Wiki
Revision as of 18:02, 2 October 2008 by 71.163.185.8 (Talk) (New page: == Description == Retrieves information about a zip code == Syntax == $zipArr = eV::addressZipDetailsGet(STR $zipCode); == Paramaters == *$zipCode STRING :: string 5 digit zip code. Incl...)
Description
Retrieves information about a zip code
Syntax
$zipArr = eV::addressZipDetailsGet(STR $zipCode);
Paramaters
- $zipCode STRING
- string 5 digit zip code. Include trailing zeros or matches will not qualify.
Return Values
Returns associative array of zip code properties. Returns boolean FALSE if zip code is not found. Returned array is as follows:
Array ( [zipCodeId] => INT [zipCode] => STR [city] => STR [state] => STR [areaCode] => STR [county] => STR [timeZone] => INT [dayLightSavings] => BIT [latitude] => DECIMAL [longitude] => DECIMAL )
Elements from the returned associative array are as follows:
Element | Description | Example |
zipCodeId | INTEGER unique ID of zip code entry in source database | 123 |
zipCode | STRING 5-digit zip code | 20817 |
city | STRING city zip code is within | Bethesda |
state | STRING 2-character state abbreviation zip code is within | MD |
areaCode | STRING 3-character area code of zip code. Multiple area codes will be delineated by slash "/". | 240/301 |
county | STRING country zip code is within | Montgomery |
timeZone | INTEGER timeZone zip code is within, stated in hours from GMT | 5 |
dayLightSavings | BIT weather or not time zone qualifies for day light savings. 1 for yes, 0 for no | 1 |
latitude | DECIMAL latitude of zip code | 38.99964000 |
longitude | DECIMAL longitude of zip code | (-77.15508000) |
Examples
// set a variable containing the zip code $zipCode = "20817"; // get the zip code information $zipData = eV:addressZipDetailsGet($zipCode); if($zipData != false) { // zip code found // output zip code information echo "Your zip code information is as follows: <ul> <li>City: " . $zipData['city'] . " <li>State: " . $zipData['state'] . " <li>County: " . $zipData['county'] . " <li>Area Code(s): " . $zipData['areaCode'] . " </ul>"; } else { // zip code not found echo "Invalid zip code!"; };