Geography Helper
The geography helper allows you to easily produce arrays of states and countries for convenient use within the form helper select function, as well as format state names, longitudes, and latitudes.
Helper Class:
Download code
<?php
/**
* Geography Helper
*
* Code by Mike O'Toole
* with inspiration from Jesse Kochis
*
*
* @version 0.1
* @author Mike O'Toole <mike.otoole at gmail dot com>
* @copyright Copyright 2006, Mike O'Toole
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
* @created 01.11.2006
* @updated 01.11.2006
* @note country list, in terms of countries included, spellings, and abbreviations used is still under review, feedback is appreciated
*/
class GeographyHelper extends Helper {
/**
* Associative array of state abbreviations and state names
*
* @var array
* @access public
*/
var $states = array('AL'=>"Alabama", 'AK'=>"Alaska", 'AZ'=>"Arizona", 'AR'=>"Arkansas", 'CA'=>"California", 'CO'=>"Colorado", 'CT'=>"Connecticut", 'DE'=>"Delaware", 'DC'=>"District Of Columbia", 'FL'=>"Florida", 'GA'=>"Georgia", 'HI'=>"Hawaii", 'ID'=>"Idaho", 'IL'=>"Illinois", 'IN'=>"Indiana", 'IA'=>"Iowa", 'KS'=>"Kansas", 'KY'=>"Kentucky", 'LA'=>"Louisiana", 'ME'=>"Maine", 'MD'=>"Maryland", 'MA'=>"Massachusetts", 'MI'=>"Michigan", 'MN'=>"Minnesota", 'MS'=>"Mississippi", 'MO'=>"Missouri", 'MT'=>"Montana", 'NE'=>"Nebraska", 'NV'=>"Nevada", 'NH'=>"New Hampshire", 'NJ'=>"New Jersey", 'NM'=>"New Mexico", 'NY'=>"New York", 'NC'=>"North Carolina", 'ND'=>"North Dakota", 'OH'=>"Ohio", 'OK'=>"Oklahoma", 'OR'=>"Oregon", 'PA'=>"Pennsylvania", 'RI'=>"Rhode Island", 'SC'=>"South Carolina", 'SD'=>"South Dakota", 'TN'=>"Tennessee", 'TX'=>"Texas", 'UT'=>"Utah", 'VT'=>"Vermont", 'VA'=>"Virginia", 'WA'=>"Washington", 'WV'=>"West Virginia", 'WI'=>"Wisconsin", 'WY'=>"Wyoming");
/**
* Associative array of 2-letter country abbreviations and country names
*
* @var array
* @access public
*/
var $countries = array(
'AC'=>'Ascension Island',
'AD'=>'Andorra',
'AE'=>'United Arab Emirates',
'AF'=>'Afghanistan',
'AG'=>'Antigua and Barbuda',
'AI'=>'Anguilla',
'AL'=>'Albania',
'AM'=>'Armenia',
'AN'=>'Netherland Antilles',
'AO'=>'Angola',
'AQ'=>'Antarctica',
'AR'=>'Argentina',
'AS'=>'American Samoa',
'AT'=>'Austria',
'AU'=>'Australia',
'AW'=>'Aruba',
'AZ'=>'Azerbaidjan',
'BA'=>'Bosnia-Herzegovina',
'BB'=>'Barbados',
'BD'=>'Bangladesh',
'BE'=>'Belgium',
'BF'=>'Burkina Faso',
'BG'=>'Bulgaria',
'BH'=>'Bahrain',
'BI'=>'Burundi',
'BJ'=>'Benin',
'BM'=>'Bermuda',
'BN'=>'Brunei Darussalam',
'BO'=>'Bolivia',
'BR'=>'Brazil',
'BS'=>'Bahamas',
'BT'=>'Buthan',
'BV'=>'Bouvet Island',
'BW'=>'Botswana',
'BY'=>'Belarus',
'BZ'=>'Belize',
'CA'=>'Canada',
'CC'=>'Cocos (Keeling) Islands',
'CD'=>'Congo, The Democratic Republic of the',
'CF'=>'Central African Rep.',
'CG'=>'Congo, Republic of',
'CH'=>'Switzerland',
'CI'=>'Ivory Coast',
'CK'=>'Cook Islands',
'CL'=>'Chile',
'CM'=>'Cameroon',
'CN'=>'China',
'CO'=>'Colombia',
'CR'=>'Costa Rica',
'CS'=>'Serbia and Montenegro',
'CU'=>'Cuba',
'CV'=>'Cape Verde',
'CX'=>'Christmas Island',
'CY'=>'Cyprus',
'CZ'=>'Czech Republic',
'DE'=>'Germany',
'DJ'=>'Djibouti',
'DK'=>'Denmark',
'DM'=>'Dominica',
'DO'=>'Dominican Republic',
'DZ'=>'Algeria',
'EC'=>'Ecuador',
'EE'=>'Estonia',
'EG'=>'Egypt',
'EH'=>'Western Sahara',
'ER'=>'Eritrea',
'ES'=>'Spain',
'ET'=>'Ethiopia',
'FI'=>'Finland',
'FJ'=>'Fiji',
'FK'=>'Falkland Islands (Malvinas)',
'FM'=>'Micronesia',
'FO'=>'Faroe Islands',
'FR'=>'France',
'GA'=>'Gabon',
'GB'=>'Great Britain (UK)',
'GD'=>'Grenada',
'GE'=>'Georgia',
'GF'=>'Guyana (Fr.)',
'GG'=>'Guernsey',
'GH'=>'Ghana',
'GI'=>'Gibraltar',
'GL'=>'Greenland',
'GM'=>'Gambia',
'GN'=>'Guinea',
'GP'=>'Guadeloupe (Fr.)',
'GQ'=>'Equatorial Guinea',
'GR'=>'Greece',
'GS'=>'South Georgia and the South Sandwich Islands',
'GT'=>'Guatemala',
'GU'=>'Guam (US)',
'GW'=>'Guinea Bissau',
'GY'=>'Guyana',
'HK'=>'Hong Kong',
'HM'=>'Heard and McDonald Islands',
'HN'=>'Honduras',
'HR'=>'Croatia',
'HT'=>'Haiti',
'HU'=>'Hungary',
'ID'=>'Indonesia',
'IE'=>'Ireland',
'IL'=>'Israel',
'IM'=>'Isle of Man',
'IN'=>'India',
'IO'=>'British Indian O. Terr.',
'IQ'=>'Iraq',
'IR'=>'Iran',
'IS'=>'Iceland',
'IT'=>'Italy',
'JM'=>'Jamaica',
'JO'=>'Jordan',
'JP'=>'Japan',
'KE'=>'Kenya',
'KG'=>'Kirgistan',
'KH'=>'Cambodia',
'KI'=>'Kiribati',
'KM'=>'Comoros',
'KN'=>'SaintKitts Nevis Anguilla',
'KP'=>'Korea (North)',
'KR'=>'Korea (South)',
'KW'=>'Kuwait',
'KY'=>'Cayman Islands',
'KZ'=>'Kazachstan',
'LA'=>'Laos',
'LB'=>'Lebanon',
'LC'=>'Saint Lucia',
'LI'=>'Liechtenstein',
'LK'=>'Sri Lanka',
'LR'=>'Liberia',
'LS'=>'Lesotho',
'LT'=>'Lithuania',
'LU'=>'Luxembourg',
'LV'=>'Latvia',
'LY'=>'Libya',
'MA'=>'Morocco',
'MC'=>'Monaco',
'MD'=>'Moldavia',
'MG'=>'Madagascar',
'MH'=>'Marshall Islands',
'MK'=>'Macedonia, The Former Yugoslav Republic of',
'ML'=>'Mali',
'MM'=>'Myanmar',
'MN'=>'Mongolia',
'MO'=>'Macau',
'MP'=>'Northern Mariana Islands',
'MQ'=>'Martinique (Fr.)',
'MR'=>'Mauritania',
'MS'=>'Montserrat',
'MT'=>'Malta',
'MU'=>'Mauritius',
'MV'=>'Maldives',
'MW'=>'Malawi',
'MX'=>'Mexico',
'MY'=>'Malaysia',
'MZ'=>'Mozambique',
'NA'=>'Namibia',
'NC'=>'New Caledonia (Fr.)',
'NE'=>'Niger',
'NF'=>'Norfolk Island',
'NG'=>'Nigeria',
'NI'=>'Nicaragua',
'NL'=>'Netherlands',
'NO'=>'Norway',
'NP'=>'Nepal',
'NR'=>'Nauru',
'NU'=>'Niue',
'NZ'=>'New Zealand',
'OM'=>'Oman',
'PA'=>'Panama',
'PE'=>'Peru',
'PF'=>'Polynesia (Fr.)',
'PG'=>'Papua New Guinea',
'PH'=>'Philippines',
'PK'=>'Pakistan',
'PL'=>'Poland',
'PM'=>'Saint Pierre and Miquelon',
'PN'=>'Pitcairn',
'PR'=>'Puerto Rico (US)',
'PT'=>'Portugal',
'PW'=>'Palau',
'PY'=>'Paraguay',
'QA'=>'Qatar',
'RE'=>'Reunion (Fr.)',
'RO'=>'Romania',
'RU'=>'Russian Federation',
'RW'=>'Rwanda',
'SA'=>'Saudi Arabia',
'SB'=>'Solomon Islands',
'SC'=>'Seychelles',
'SD'=>'Sudan',
'SE'=>'Sweden',
'SG'=>'Singapore',
'SH'=>'Saint Helena',
'SI'=>'Slovenia',
'SJ'=>'Svalbard and Jan Mayen Islands',
'SK'=>'Slovak Republic',
'SL'=>'Sierra Leone',
'SM'=>'San Marino',
'SN'=>'Senegal',
'SO'=>'Somalia',
'SR'=>'Suriname',
'ST'=>'Saint Tome and Principe',
'SV'=>'El Salvador',
'SY'=>'Syria',
'SZ'=>'Swaziland',
'TC'=>'Turks and Caicos Islands',
'TD'=>'Chad',
'TF'=>'French Southern Territories',
'TG'=>'Togo',
'TH'=>'Thailand',
'TJ'=>'Tadjikistan',
'TK'=>'Tokelau',
'TM'=>'Turkmenistan',
'TN'=>'Tunisia',
'TO'=>'Tonga',
'TP'=>'East Timor',
'TR'=>'Turkey',
'TT'=>'Trinidad and Tobago',
'TV'=>'Tuvalu',
'TW'=>'Taiwan',
'TZ'=>'Tanzania',
'UA'=>'Ukraine',
'UG'=>'Uganda',
'UK'=>'United Kingdom',
'UM'=>'US Minor outlying Islands',
'US'=>'United States',
'UY'=>'Uruguay',
'UZ'=>'Uzbekistan',
'VA'=>'Vatican City State',
'VC'=>'SaintVincent and Grenadines',
'VE'=>'Venezuela',
'VG'=>'Virgin Islands (British)',
'VI'=>'Virgin Islands (US)',
'VN'=>'Vietnam',
'VU'=>'Vanuatu',
'WF'=>'Wallis and Futuna Islands',
'WS'=>'Samoa',
'YE'=>'Yemen',
'YU'=>'Yugoslavia',
'ZA'=>'South Africa',
'ZM'=>'Zambia',
'ZR'=>'Zaire',
'ZW'=>'Zimbabwe'
);
/**
* Returns a string containing a two letter state name abbreviation. If no abbreviation matches the state name, the name is returned.
*
* @param int $stateName the full name of a US State
* @param array $customList an associative array with the abbreviations as the key and full names as the value,
* for adding, editing, or removing states
ie array('QC' => 'Quebec','MA' => 'Massachusett', 'NJ' => '') would add Quebec to the return possibilities,
change Massachusetts to Massachusett, and eliminate New Jersey from the return possibilities.
* @return string two letter abbreviation for the given state
*/
function stateAbbrev($stateName, $customList = array())
{
$states = $this->_array_trim(am($this->states, $customList));
if($abbr = array_search($stateName, $states))
{
return $abbr;
}
return $stateName;
}
/**
* Returns a string containing a full state name. If no state matches the abbreviation, the abbreviation is returned.
*
* @param int $abbr the two letter state abbreviation
* @param array $customList an associative array with the abbreviations as the key and full names as the value,
* for adding, editing, or removing states
ie array('QC' => 'Quebec','MA' => 'Massachusett', 'NJ' => '') would add Quebec to the return possibilities,
change Massachusetts to Massachusett, and eliminate New Jersey from the return possibilities.
* @return string the full name of a state
*/
function stateFull($abbr, $customList = array())
{
$states = $this->_array_trim(am($this->states, $customList));
if(isset($states[$abbr]))
{
return $states[$abbr];
}
return $abbr;
}
/**
* Returns an associative array with state abbreviations as the key and full state names as the value
* Convenient for use with the form helper select function
*
* @param array $customList an associative array with the abbreviations as the key and full names as the value,
* for adding, editing, or removing states
ie array('QC' => 'Quebec','MA' => 'Massachusett', 'NJ' => '') would add Quebec to the return possibilities,
change Massachusetts to Massachusett, and eliminate New Jersey from the return possibilities.
* @return array key as state abbreviation, value as state name
*/
function stateList($customList = array())
{
$states = $this->_array_trim(am($this->states, $customList));
ksort($states);
return $states;
}
/**
* Returns an associative array with two letter country abbreviations as the key and full country names as the value
* Convenient for use with the form helper select function
*
* @param array $customList an associative array with the abbreviations as the key and full names as the value,
* for adding, editing, or removing countries
ie array('QC' => 'Quebec','US' => 'USA', 'AL' => '') would add Quebec to the return possibilities,
change United States of America to USA, and eliminate Albania from the return possibilities.
* @return array key as country abbreviation, value as country name
*/
function countryList($customList = array())
{
$countries = $this->_array_trim(am($this->countries, $customList));
ksort($countries);
return $countries;
}
/**
* Returns a latitude string in the format 42°21'29" N
*
* @param int $val latitude in decimal form (42.358)
* @return string formatted latitude (42°21'29" N)
*/
function formatLatitude($val)
{
$formatVal = $this->_formatLonLat($val);
if($val < 0)
{
$dir = "S";
}
else
{
$dir = "N";
}
return $formatVal.' '.$dir;
}
/**
* Returns a longitude string in the format 71°03'36" W
*
* @param int $val longitude in decimal form (-71.06)
* @return string formatted longitude (71°03'36" W)
*/
function formatLongitude($val)
{
$formatVal = $this->_formatLonLat($val);
if($val < 0) {
$dir = "W";
}
elseif($val > 0) {
$dir = "E";
}
return $formatVal.' '.$dir;
}
/*Private method used to format both latitude and longitude from decimal to degrees*/
function _formatLonLat($val)
{
$deg = floor(abs($val));
$tempm = (abs($val)-$deg)*100;
$min = $tempm*.6;
$temps = round(($min-floor($min))*100);
$min = floor($min);
$sec = round(.6*$temps);
if ($min < 10)
{
$min = '0'.$min;
}
if ($sec < 10)
{
$sec = '0'.$sec;
}
return "$deg°$min'$sec\"";
}
/*Private method used to eliminate empty entries from the array*/
function _array_trim($a)
{
$b = array();
foreach ($a as $key => $val)
{
if (!empty($a[$key]))
{
$b[$key] = $val;
}
}
return $b;
}
}
?>
Comments
Bug
1 Country list contains countries twice
Comment
2 Fixed
Fixed. Thanks!
Comment
3 Country list
I normally use the country list from the CIA World Factbook https://www.cia.gov/cia/publications/factbook/index.html because it's updated often and has the latest 'valid' list.
Comment
4 New country list
Here's a quick'n'dirty little script to parse the wikipedia page and give you a nice $countries array:
$xmlfile = 'ISO_3166-1.xml';
$wpurl = 'http://en.wikipedia.org/wiki/Special:Export/ISO_3166-1';
if ($in = file_get_contents($xmlfile)) {
} else if ($in = file_get_contents($wpurl)) {
} else die("No Input!\n\n");
preg_match_all('/.*?\|{{country\|flagcountry\|((.*?))}}.*?\|\| (..) \|\|.*?\]\].*?/s', $in, $out);
$fp = fopen('countries_array.txt', 'w');
fwrite($fp, '$countries = array('."\n");
for ($i = 0; $i < sizeof($out[1]); $i++) {
fwrite($fp, "\t'".$out[3][$i]."'=>");
$out[1][$i] = preg_replace('/.*\|name=(.*)/', '\\1', $out[1][$i]);
$out[1][$i] = str_replace("'", "\'", $out[1][$i]);
fwrite($fp, "'".$out[1][$i]."',\n");
}
fwrite($fp, ");\n");
fclose($fp);
?>
Comment
5 Not working
I tried you code. But its giving this error.
Warning: file_get_contents(ISO_3166-1.xml) [function.file-get-contents]: failed to open stream: No such file or directory in F:\wamp\www\country.php on line 5
Warning: file_get_contents(http://en.wikipedia.org/wiki/Special:Export/ISO_3166-1) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden in F:\wamp\www\country.php on line 6
No Input!nn
Comment
6 A better list
http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/index.html
Comment
7 Better list translated to php
<?
$countries = array(
'AF'=>'Afghanistan',
'AX'=>'Ă…land Islands',
'AL'=>'Albania',
'DZ'=>'Algeria',
'AS'=>'American Samoa',
'AD'=>'Andorra',
'AO'=>'Angola',
'AI'=>'Anguilla',
'AQ'=>'Antarctica',
'AG'=>'Antigua And Barbuda',
'AR'=>'Argentina',
'AM'=>'Armenia',
'AW'=>'Aruba',
'AU'=>'Australia',
'AT'=>'Austria',
'AZ'=>'Azerbaijan',
'BS'=>'Bahamas',
'BH'=>'Bahrain',
'BD'=>'Bangladesh',
'BB'=>'Barbados',
'BY'=>'Belarus',
'BE'=>'Belgium',
'BZ'=>'Belize',
'BJ'=>'Benin',
'BM'=>'Bermuda',
'BT'=>'Bhutan',
'BO'=>'Bolivia',
'BA'=>'Bosnia And Herzegovina',
'BW'=>'Botswana',
'BV'=>'Bouvet Island',
'BR'=>'Brazil',
'IO'=>'British Indian Ocean Territory',
'BN'=>'Brunei Darussalam',
'BG'=>'Bulgaria',
'BF'=>'Burkina Faso',
'BI'=>'Burundi',
'KH'=>'Cambodia',
'CM'=>'Cameroon',
'CA'=>'Canada',
'CV'=>'Cape Verde',
'KY'=>'Cayman Islands',
'CF'=>'Central African Republic',
'TD'=>'Chad',
'CL'=>'Chile',
'CN'=>'China',
'CX'=>'Christmas Island',
'CC'=>'Cocos (keeling) Islands',
'CO'=>'Colombia',
'KM'=>'Comoros',
'CG'=>'Congo',
'CD'=>'Congo, The Democratic Republic Of The',
'CK'=>'Cook Islands',
'CR'=>'Costa Rica',
'CI'=>'Cote D\'ivoire',
'HR'=>'Croatia',
'CU'=>'Cuba',
'CY'=>'Cyprus',
'CZ'=>'Czech Republic',
'DK'=>'Denmark',
'DJ'=>'Djibouti',
'DM'=>'Dominica',
'DO'=>'Dominican Republic',
'EC'=>'Ecuador',
'EG'=>'Egypt',
'SV'=>'El Salvador',
'GQ'=>'Equatorial Guinea',
'ER'=>'Eritrea',
'EE'=>'Estonia',
'ET'=>'Ethiopia',
'FK'=>'Falkland Islands (malvinas)',
'FO'=>'Faroe Islands',
'FJ'=>'Fiji',
'FI'=>'Finland',
'FR'=>'France',
'GF'=>'French Guiana',
'PF'=>'French Polynesia',
'TF'=>'French Southern Territories',
'GA'=>'Gabon',
'GM'=>'Gambia',
'GE'=>'Georgia',
'DE'=>'Germany',
'GH'=>'Ghana',
'GI'=>'Gibraltar',
'GR'=>'Greece',
'GL'=>'Greenland',
'GD'=>'Grenada',
'GP'=>'Guadeloupe',
'GU'=>'Guam',
'GT'=>'Guatemala',
'GG'=>'Guernsey',
'GN'=>'Guinea',
'GW'=>'Guinea-bissau',
'GY'=>'Guyana',
'HT'=>'Haiti',
'HM'=>'Heard Island And Mcdonald Islands',
'VA'=>'Holy See (vatican City State)',
'HN'=>'Honduras',
'HK'=>'Hong Kong',
'HU'=>'Hungary',
'IS'=>'Iceland',
'IN'=>'India',
'ID'=>'Indonesia',
'IR'=>'Iran, Islamic Republic Of',
'IQ'=>'Iraq',
'IE'=>'Ireland',
'IM'=>'Isle Of Man',
'IL'=>'Israel',
'IT'=>'Italy',
'JM'=>'Jamaica',
'JP'=>'Japan',
'JE'=>'Jersey',
'JO'=>'Jordan',
'KZ'=>'Kazakhstan',
'KE'=>'Kenya',
'KI'=>'Kiribati',
'KP'=>'Korea, Democratic People\'s Republic Of',
'KR'=>'Korea, Republic Of',
'KW'=>'Kuwait',
'KG'=>'Kyrgyzstan',
'LA'=>'Lao People\'s Democratic Republic',
'LV'=>'Latvia',
'LB'=>'Lebanon',
'LS'=>'Lesotho',
'LR'=>'Liberia',
'LY'=>'Libyan Arab Jamahiriya',
'LI'=>'Liechtenstein',
'LT'=>'Lithuania',
'LU'=>'Luxembourg',
'MO'=>'Macao',
'MK'=>'Macedonia, The Former Yugoslav Republic Of',
'MG'=>'Madagascar',
'MW'=>'Malawi',
'MY'=>'Malaysia',
'MV'=>'Maldives',
'ML'=>'Mali',
'MT'=>'Malta',
'MH'=>'Marshall Islands',
'MQ'=>'Martinique',
'MR'=>'Mauritania',
'MU'=>'Mauritius',
'YT'=>'Mayotte',
'MX'=>'Mexico',
'FM'=>'Micronesia, Federated States Of',
'MD'=>'Moldova, Republic Of',
'MC'=>'Monaco',
'MN'=>'Mongolia',
'ME'=>'Montenegro',
'MS'=>'Montserrat',
'MA'=>'Morocco',
'MZ'=>'Mozambique',
'MM'=>'Myanmar',
'NA'=>'Namibia',
'NR'=>'Nauru',
'NP'=>'Nepal',
'NL'=>'Netherlands',
'AN'=>'Netherlands Antilles',
'NC'=>'New Caledonia',
'NZ'=>'New Zealand',
'NI'=>'Nicaragua',
'NE'=>'Niger',
'NG'=>'Nigeria',
'NU'=>'Niue',
'NF'=>'Norfolk Island',
'MP'=>'Northern Mariana Islands',
'NO'=>'Norway',
'OM'=>'Oman',
'PK'=>'Pakistan',
'PW'=>'Palau',
'PS'=>'Palestinian Territory, Occupied',
'PA'=>'Panama',
'PG'=>'Papua New Guinea',
'PY'=>'Paraguay',
'PE'=>'Peru',
'PH'=>'Philippines',
'PN'=>'Pitcairn',
'PL'=>'Poland',
'PT'=>'Portugal',
'PR'=>'Puerto Rico',
'QA'=>'Qatar',
'RE'=>'Reunion',
'RO'=>'Romania',
'RU'=>'Russian Federation',
'RW'=>'Rwanda',
'SH'=>'Saint Helena',
'KN'=>'Saint Kitts And Nevis',
'LC'=>'Saint Lucia',
'PM'=>'Saint Pierre And Miquelon',
'VC'=>'Saint Vincent And The Grenadines',
'WS'=>'Samoa',
'SM'=>'San Marino',
'ST'=>'Sao Tome And Principe',
'SA'=>'Saudi Arabia',
'SN'=>'Senegal',
'RS'=>'Serbia',
'SC'=>'Seychelles',
'SL'=>'Sierra Leone',
'SG'=>'Singapore',
'SK'=>'Slovakia',
'SI'=>'Slovenia',
'SB'=>'Solomon Islands',
'SO'=>'Somalia',
'ZA'=>'South Africa',
'GS'=>'South Georgia And The South Sandwich Islands',
'ES'=>'Spain',
'LK'=>'Sri Lanka',
'SD'=>'Sudan',
'SR'=>'Suriname',
'SJ'=>'Svalbard And Jan Mayen',
'SZ'=>'Swaziland',
'SE'=>'Sweden',
'CH'=>'Switzerland',
'SY'=>'Syrian Arab Republic',
'TW'=>'Taiwan, Province Of China',
'TJ'=>'Tajikistan',
'TZ'=>'Tanzania, United Republic Of',
'TH'=>'Thailand',
'TL'=>'Timor-leste',
'TG'=>'Togo',
'TK'=>'Tokelau',
'TO'=>'Tonga',
'TT'=>'Trinidad And Tobago',
'TN'=>'Tunisia',
'TR'=>'Turkey',
'TM'=>'Turkmenistan',
'TC'=>'Turks And Caicos Islands',
'TV'=>'Tuvalu',
'UG'=>'Uganda',
'UA'=>'Ukraine',
'AE'=>'United Arab Emirates',
'GB'=>'United Kingdom',
'US'=>'United States',
'UM'=>'United States Minor Outlying Islands',
'UY'=>'Uruguay',
'UZ'=>'Uzbekistan',
'VU'=>'Vanuatu',
'VE'=>'Venezuela',
'VN'=>'Viet Nam',
'VG'=>'Virgin Islands, British',
'VI'=>'Virgin Islands, U.s.',
'WF'=>'Wallis And Futuna',
'EH'=>'Western Sahara',
'YE'=>'Yemen',
'ZM'=>'Zambia',
'ZW'=>'Zimbabwe',
);
?>