代码片段:国家代码缩写

function instanter_country_code($fullname) {
    static $country;
    if(!isset($country)) {
    $country = array();
$country['Albania']= 'AL';
$country['Algeria']= 'DZ';
$country['Afghanistan']= 'AF';
$country['Argentina']= 'AR';
$country['United Arab Emirates']= 'AE';
$country['Aruba']= 'AW';
$country['Oman']= 'OM';
$country['Azerbaijan']= 'AZ';
$country['Egypt']= 'EG';
$country['Ethiopia']= 'ET';
$country['Ireland']= 'IE';
$country['Estonia']= 'EE';
$country['Andorra']= 'AD';
$country['Angola']= 'AO';
$country['Anguilla']= 'AI';
$country['Antigua and Barbuda']= 'AG';
$country['Austria']= 'AT';
$country['Australia']= 'AU';
$country['Macau']= 'MO';
$country['Barbados']= 'BB';
$country['Papua New Guinea']= 'PG';
$country['Bahamas']= 'BS';
$country['Pakistan']= 'PK';
$country['Paraguay']= 'PY';
$country['Palestine']= 'PS';
$country['Bahrain']= 'BH';
$country['Panama']= 'PA';
$country['Brazil']= 'BR';
$country['Belarus']= 'BY';
$country['Bermuda']= 'BM';
$country['Bulgaria']= 'BG';
$country['Northern Marianas']= 'MP';
$country['Palau']= 'PW';
$country['Benin']= 'BJ';
$country['Belgium']= 'BE';
$country['Iceland']= 'IS';
$country['Puerto Rico']= 'PR';
$country['Poland']= 'PL';
$country['Bolivia']= 'BO';
$country['Bosnia and Herzegovina']= 'BA';
$country['Botswana']= 'BW';
$country['Belize']= 'BZ';
$country['Bhutan']= 'BT';
$country['Burkina Faso']= 'BF';
$country['Burundi']= 'BI';
$country['Bouvet Island']= 'BV';
$country["Korea,Democratic People's Republic of"]= 'KP';
$country['Equatorial Guinea']= 'GQ';
$country['Denmark']= 'DK';
$country['Germany']= 'DE';
$country['East Timor']= 'TP';
$country['Togo']= 'TG';
$country['Dominican Republic']= 'DO';
$country['Dominica']= 'DM';
$country['Russia']= 'RU';
$country['Ecuador']= 'EC';
$country['Eritrea']= 'ER';
$country['France']= 'FR';
$country['Faroe Islands']= 'FO';
$country['French Polynesia']= 'PF';
$country['French Guiana']= 'GF';
$country['French Southern Territo-ries']= 'TF';
$country['Vatican']= 'VA';
$country['Philippines']= 'PH';
$country['Fiji']= 'FJ';
$country['Finland']= 'FI';
$country['Cape Verde']= 'CV';
$country['Gambia']= 'GM';
$country['Congo']= 'CG';
$country['Colombia']= 'Co';
$country['Costa Rica']= 'CR';
$country['Grenada']= 'GD';
$country['Greenland']= 'GL';
$country['Georgia']= 'GE';
$country['Cuba']= 'CU';
$country['Guadeloupe']= 'GP';
$country['Guam']= 'GU';
$country['Guyana']= 'GY';
$country['Kazakhstan']= 'KZ';
$country['Haiti']= 'HT';
$country['Korea,Republic of']= 'KR';
$country['Netherlands']= 'NL';
$country['Netherlands Antilles']= 'AN';
$country['Heard islands and Mc Donald Islands']= 'HM';
$country['Honduras']= 'HN';
$country['Kiribati']= 'KI';
$country['Djibouti']= 'DJ';
$country['Kyrgyzstan']= 'KG';
$country['Guinea']= 'GN';
$country['Guine-bissau']= 'GW';
$country['Canada']= 'CA';
$country['Ghana']= 'GH';
$country['Gabon']= 'GA';
$country['Cambodia']= 'KH';
$country['Czech Repoublic']= 'CZ';
$country['Zimbabwe']= 'ZW';
$country['Cameroon']= 'CM';
$country['Qatar']= 'QA';
$country['Cayman Islands']= 'KY';
$country['Cocos(Keeling) Islands']= 'CC';
$country['Comoros']= 'KM';
$country["Cote d'Ivoire"]= 'CI';
$country['Kuwait']= 'KW';
$country['Croatia']= 'HR';
$country['Kenya']= 'KE';
$country['Cook Islands']= 'CK';
$country['Latvia']= 'LV';
$country['Lesotho']= 'LS';
$country['Lao']= 'LA';
$country['Lebanon']= 'LB';
$country['Liberia']= 'LR';
$country['Libya']= 'LY';
$country['Lithuania']= 'LT';
$country['Liechtenstein']= 'LI';
$country['Reunion']= 'RE';
$country['Luxembourg']= 'LU';
$country['Rwanda']= 'RW';
$country['Romania']= 'RO';
$country['Madagascar']= 'MG';
$country['Malta']= 'MT';
$country['Maldives']= 'MV';
$country['Malvinas Islands (Falkland Islands)']= 'FK';
$country['Malawi']= 'MW';
$country['Malaysia']= 'MY';
$country['Mali']= 'ML';
$country['Macedonia']= 'MK';
$country['Marshall Islands']= 'MH';
$country['Martinique']= 'MQ';
$country['Mayotte']= 'YT';
$country['Mauritius']= 'MU';
$country['Mauritania']= 'MR';
$country['United States']= 'US';
$country['American Samoa']= 'AS';
$country['United States miscella-neous Pac']= 'UM';
$country['United States Virgin Is-lands']= 'VI';
$country['Mongolia']= 'MN';
$country['Montserrat']= 'MS';
$country['Bangladesh']= 'BD';
$country['Peru']= 'PE';
$country['Micronesia']= 'FM';
$country['Myanmar']= 'MM';
$country['Moldova']= 'MD';
$country['Morocco']= 'MA';
$country['Monaco']= 'MC';
$country['Mozambique']= 'MZ';
$country['Mexico']= 'MX';
$country['Namibia']= 'NA';
$country['South Africa']= 'ZA';
$country['Antarctica']= 'AQ';
$country['South Georgia and South Sandwich Islands']= 'GS';
$country['Yugoslavia']= 'YU';
$country['Nauru']= 'NR';
$country['Nepal']= 'NP';
$country['Nicaragua']= 'NI';
$country['Niger']= 'NE';
$country['Nigeria']= 'NG';
$country['Niue']= 'NU';
$country['Norway']= 'NO';
$country['Norfolk Island']= 'NF';
$country['Pitcairn Islands Group']= 'PN';
$country['Portugal']= 'PT';
$country['Japan']= 'JP';
$country['Sweden']= 'SE';
$country['Switzerland']= 'CH';
$country['El Salvador']= 'SV';
$country['Sierra leone']= 'SL';
$country['Senegal']= 'SN';
$country['Cyprus']= 'CY';
$country['Seychells']= 'SC';
$country['Saudi Arabia']= 'SA';
$country['Christmas Island']= 'CS';
$country['Sao Tome and Principe']= 'St';
$country['Saint helena']= 'Sh';
$country['Saint Kitts and nevis']= 'KN';
$country['Saint lucia']= 'LC';
$country['San Marion']= 'SM';
$country['Saint Pierre and Miquelon']= 'PM';
$country['Saint Vincent and the Grenadines']= 'VC';
$country['Sri Lanka']= 'LK';
$country['Slovakia']= 'SK';
$country['Slovenia']= 'SI';
$country['Svalbard and jan Mayen Islands']= 'SJ';
$country['Swaziland']= 'SZ';
$country['Sudan']= 'SD';
$country['Suriname']= 'SR';
$country['Somalia']= 'SO';
$country['Solomon Islands']= 'SB';
$country['Tajikistan']= 'TJ';
$country['Thailand']= 'TH';
$country['Tanzania']= 'TZ';
$country['Tonga']= 'TO';
$country['Turks and Caicos Islands']= 'TC';
$country['Trinidad and Tobago']= 'TT';
$country['Tunisia']= 'TN';
$country['Tuvalu']= 'TV';
$country['Turkey']= 'TR';
$country['Turkmenistan']= 'TM';
$country['Tokelau']= 'TK';
$country['Wallis and Futuna Is-lands']= 'WF';
$country['Vanuatu']= 'VU';
$country['Guatemala']= 'GT';
$country['Venezuela']= 'VE';
$country['Brunei Darussalam']= 'BN';
$country['Uganda']= 'UG';
$country['Ukraine']= 'UA';
$country['Uruguay']= 'UY';
$country['Uzbekistan']= 'UZ';
$country['Spain']= 'ES';
$country['Western Sahara']= 'EH';
$country['Western Samoa']= 'WS';
$country['Greece']= 'GR';
$country['Hong Kong']= 'HK';
$country['Singapore']= 'SG';
$country['New Caledonia']= 'NC';
$country['New Zealand']= 'NZ';
$country['Hungary']= 'HU';
$country['Syria']= 'SY';
$country['Jamaica']= 'JM';
$country['Armenia']= 'AM';
$country['Yemen']= 'YE';
$country['Iraq']= 'IQ';
$country['Iran']= 'IR';
$country['Israel']= 'IL';
$country['Italy']= 'IT';
$country['India']= 'IN';
$country['Indonesia']= 'ID';
$country['United Kingdom']= 'GB';
$country['British Virgin Islands']= 'VG';
$country['British indian Ocean Ter-ritory']= 'IO';
$country['Jordan']= 'JO';
$country['Viet Nam']= 'VN';
$country['Zambia']= 'ZM';
$country['Zaire']= 'ZR';
$country['Chad']= 'TD';
$country['Gibraltar']= 'GI';
$country['Chile']= 'CL';
$country['Central Africa']= 'CF';
$country['China']= 'CN';
$country['Taiwan,China']= 'CT';
    }

    return $country[$fullname];
}
posted @ 2011-05-20 08:46  猫之良品  阅读(905)  评论(1编辑  收藏  举报