Skip to content

Instantly share code, notes, and snippets.

@vxnick
Created April 27, 2010 15:52
Show Gist options
  • Save vxnick/380904 to your computer and use it in GitHub Desktop.
Save vxnick/380904 to your computer and use it in GitHub Desktop.
Array of country codes (ISO 3166-1 alpha-2) and corresponding names
<?php
$countries = array
(
'AF' => 'Afghanistan',
'AX' => 'Aland 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, Democratic Republic',
'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 & 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',
'KR' => 'Korea',
'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',
'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',
'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',
'BL' => 'Saint Barthelemy',
'SH' => 'Saint Helena',
'KN' => 'Saint Kitts And Nevis',
'LC' => 'Saint Lucia',
'MF' => 'Saint Martin',
'PM' => 'Saint Pierre And Miquelon',
'VC' => 'Saint Vincent And 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 Sandwich Isl.',
'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',
'TJ' => 'Tajikistan',
'TZ' => 'Tanzania',
'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 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',
);
?>
@zahirkelloud
Copy link

zahirkelloud commented Dec 19, 2018

country abrev and phone code in javascript

countryCodes = [
	{ 'AD': {'name': 'ANDORRA','code': '376'} },
	{ 'AE': {'name': 'UNITED ARAB EMIRATES','code': '971'} },
	{ 'AF': {'name': 'AFGHANISTAN','code': '93'} },
	{ 'AG': {'name': 'ANTIGUA AND BARBUDA','code': '1268'} },
	{ 'AI': {'name': 'ANGUILLA','code': '1264'} },
	{ 'AL': {'name': 'ALBANIA','code': '355'} },
	{ 'AM': {'name': 'ARMENIA','code': '374'} },
	{ 'AN': {'name': 'NETHERLANDS ANTILLES','code': '599'} },
	{ 'AO': {'name': 'ANGOLA','code': '244'} },
	{ 'AQ': {'name': 'ANTARCTICA','code': '672'} },
	{ 'AR': {'name': 'ARGENTINA','code': '54'} },
	{ 'AS': {'name': 'AMERICAN SAMOA','code': '1684'} },
	{ 'AT': {'name': 'AUSTRIA','code': '43'} },
	{ 'AU': {'name': 'AUSTRALIA','code': '61'} },
	{ 'AW': {'name': 'ARUBA','code': '297'} },
	{ 'AZ': {'name': 'AZERBAIJAN','code': '994'} },
	{ 'BA': {'name': 'BOSNIA AND HERZEGOVINA','code': '387'} },
	{ 'BB': {'name': 'BARBADOS','code': '1246'} },
	{ 'BD': {'name': 'BANGLADESH','code': '880'} },
	{ 'BE': {'name': 'BELGIUM','code': '32'} },
	{ 'BF': {'name': 'BURKINA FASO','code': '226'} },
	{ 'BG': {'name': 'BULGARIA','code': '359'} },
	{ 'BH': {'name': 'BAHRAIN','code': '973'} },
	{ 'BI': {'name': 'BURUNDI','code': '257'} },
	{ 'BJ': {'name': 'BENIN','code': '229'} },
	{ 'BL': {'name': 'SAINT BARTHELEMY','code': '590'} },
	{ 'BM': {'name': 'BERMUDA','code': '1441'} },
	{ 'BN': {'name': 'BRUNEI DARUSSALAM','code': '673'} },
	{ 'BO': {'name': 'BOLIVIA','code': '591'} },
	{ 'BR': {'name': 'BRAZIL','code': '55'} },
	{ 'BS': {'name': 'BAHAMAS','code': '1242'} },
	{ 'BT': {'name': 'BHUTAN','code': '975'} },
	{ 'BW': {'name': 'BOTSWANA','code': '267'} },
	{ 'BY': {'name': 'BELARUS','code': '375'} },
	{ 'BZ': {'name': 'BELIZE','code': '501'} },
	{ 'CA': {'name': 'CANADA','code': '1'} },
	{ 'CC': {'name': 'COCOS (KEELING) ISLANDS','code': '61'} },
	{ 'CD': {'name': 'CONGO, THE DEMOCRATIC REPUBLIC OF THE','code': '243'} },
	{ 'CF': {'name': 'CENTRAL AFRICAN REPUBLIC','code': '236'} },
	{ 'CG': {'name': 'CONGO','code': '242'} },
	{ 'CH': {'name': 'SWITZERLAND','code': '41'} },
	{ 'CI': {'name': 'COTE D IVOIRE','code': '225'} },
	{ 'CK': {'name': 'COOK ISLANDS','code': '682'} },
	{ 'CL': {'name': 'CHILE','code': '56'} },
	{ 'CM': {'name': 'CAMEROON','code': '237'} },
	{ 'CN': {'name': 'CHINA','code': '86'} },
	{ 'CO': {'name': 'COLOMBIA','code': '57'} },
	{ 'CR': {'name': 'COSTA RICA','code': '506'} },
	{ 'CU': {'name': 'CUBA','code': '53'} },
	{ 'CV': {'name': 'CAPE VERDE','code': '238'} },
	{ 'CX': {'name': 'CHRISTMAS ISLAND','code': '61'} },
	{ 'CY': {'name': 'CYPRUS','code': '357'} },
	{ 'CZ': {'name': 'CZECH REPUBLIC','code': '420'} },
	{ 'DE': {'name': 'GERMANY','code': '49'} },
	{ 'DJ': {'name': 'DJIBOUTI','code': '253'} },
	{ 'DK': {'name': 'DENMARK','code': '45'} },
	{ 'DM': {'name': 'DOMINICA','code': '1767'} },
	{ 'DO': {'name': 'DOMINICAN REPUBLIC','code': '1809'} },
	{ 'DZ': {'name': 'ALGERIA','code': '213'} },
	{ 'EC': {'name': 'ECUADOR','code': '593'} },
	{ 'EE': {'name': 'ESTONIA','code': '372'} },
	{ 'EG': {'name': 'EGYPT','code': '20'} },
	{ 'ER': {'name': 'ERITREA','code': '291'} },
	{ 'ES': {'name': 'SPAIN','code': '34'} },
	{ 'ET': {'name': 'ETHIOPIA','code': '251'} },
	{ 'FI': {'name': 'FINLAND','code': '358'} },
	{ 'FJ': {'name': 'FIJI','code': '679'} },
	{ 'FK': {'name': 'FALKLAND ISLANDS (MALVINAS)','code': '500'} },
	{ 'FM': {'name': 'MICRONESIA, FEDERATED STATES OF','code': '691'} },
	{ 'FO': {'name': 'FAROE ISLANDS','code': '298'} },
	{ 'FR': {'name': 'FRANCE','code': '33'} },
	{ 'GA': {'name': 'GABON','code': '241'} },
	{ 'GB': {'name': 'UNITED KINGDOM','code': '44'} },
	{ 'GD': {'name': 'GRENADA','code': '1473'} },
	{ 'GE': {'name': 'GEORGIA','code': '995'} },
	{ 'GH': {'name': 'GHANA','code': '233'} },
	{ 'GI': {'name': 'GIBRALTAR','code': '350'} },
	{ 'GL': {'name': 'GREENLAND','code': '299'} },
	{ 'GM': {'name': 'GAMBIA','code': '220'} },
	{ 'GN': {'name': 'GUINEA','code': '224'} },
	{ 'GQ': {'name': 'EQUATORIAL GUINEA','code': '240'} },
	{ 'GR': {'name': 'GREECE','code': '30'} },
	{ 'GT': {'name': 'GUATEMALA','code': '502'} },
	{ 'GU': {'name': 'GUAM','code': '1671'} },
	{ 'GW': {'name': 'GUINEA-BISSAU','code': '245'} },
	{ 'GY': {'name': 'GUYANA','code': '592'} },
	{ 'HK': {'name': 'HONG KONG','code': '852'} },
	{ 'HN': {'name': 'HONDURAS','code': '504'} },
	{ 'HR': {'name': 'CROATIA','code': '385'} },
	{ 'HT': {'name': 'HAITI','code': '509'} },
	{ 'HU': {'name': 'HUNGARY','code': '36'} },
	{ 'ID': {'name': 'INDONESIA','code': '62'} },
	{ 'IE': {'name': 'IRELAND','code': '353'} },
	{ 'IL': {'name': 'ISRAEL','code': '972'} },
	{ 'IM': {'name': 'ISLE OF MAN','code': '44'} },
	{ 'IN': {'name': 'INDIA','code': '91'} },
	{ 'IQ': {'name': 'IRAQ','code': '964'} },
	{ 'IR': {'name': 'IRAN, ISLAMIC REPUBLIC OF','code': '98'} },
	{ 'IS': {'name': 'ICELAND','code': '354'} },
	{ 'IT': {'name': 'ITALY','code': '39'} },
	{ 'JM': {'name': 'JAMAICA','code': '1876'} },
	{ 'JO': {'name': 'JORDAN','code': '962'} },
	{ 'JP': {'name': 'JAPAN','code': '81'} },
	{ 'KE': {'name': 'KENYA','code': '254'} },
	{ 'KG': {'name': 'KYRGYZSTAN','code': '996'} },
	{ 'KH': {'name': 'CAMBODIA','code': '855'} },
	{ 'KI': {'name': 'KIRIBATI','code': '686'} },
	{ 'KM': {'name': 'COMOROS','code': '269'} },
	{ 'KN': {'name': 'SAINT KITTS AND NEVIS','code': '1869'} },
	{ 'KP': {'name': 'KOREA DEMOCRATIC PEOPLES REPUBLIC OF','code': '850'} },
	{ 'KR': {'name': 'KOREA REPUBLIC OF','code': '82'} },
	{ 'KW': {'name': 'KUWAIT','code': '965'} },
	{ 'KY': {'name': 'CAYMAN ISLANDS','code': '1345'} },
	{ 'KZ': {'name': 'KAZAKSTAN','code': '7'} },
	{ 'LA': {'name': 'LAO PEOPLES DEMOCRATIC REPUBLIC','code': '856'} },
	{ 'LB': {'name': 'LEBANON','code': '961'} },
	{ 'LC': {'name': 'SAINT LUCIA','code': '1758'} },
	{ 'LI': {'name': 'LIECHTENSTEIN','code': '423'} },
	{ 'LK': {'name': 'SRI LANKA','code': '94'} },
	{ 'LR': {'name': 'LIBERIA','code': '231'} },
	{ 'LS': {'name': 'LESOTHO','code': '266'} },
	{ 'LT': {'name': 'LITHUANIA','code': '370'} },
	{ 'LU': {'name': 'LUXEMBOURG','code': '352'} },
	{ 'LV': {'name': 'LATVIA','code': '371'} },
	{ 'LY': {'name': 'LIBYAN ARAB JAMAHIRIYA','code': '218'} },
	{ 'MA': {'name': 'MOROCCO','code': '212'} },
	{ 'MC': {'name': 'MONACO','code': '377'} },
	{ 'MD': {'name': 'MOLDOVA, REPUBLIC OF','code': '373'} },
	{ 'ME': {'name': 'MONTENEGRO','code': '382'} },
	{ 'MF': {'name': 'SAINT MARTIN','code': '1599'} },
	{ 'MG': {'name': 'MADAGASCAR','code': '261'} },
	{ 'MH': {'name': 'MARSHALL ISLANDS','code': '692'} },
	{ 'MK': {'name': 'MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF','code': '389'} },
	{ 'ML': {'name': 'MALI','code': '223'} },
	{ 'MM': {'name': 'MYANMAR','code': '95'} },
	{ 'MN': {'name': 'MONGOLIA','code': '976'} },
	{ 'MO': {'name': 'MACAU','code': '853'} },
	{ 'MP': {'name': 'NORTHERN MARIANA ISLANDS','code': '1670'} },
	{ 'MR': {'name': 'MAURITANIA','code': '222'} },
	{ 'MS': {'name': 'MONTSERRAT','code': '1664'} },
	{ 'MT': {'name': 'MALTA','code': '356'} },
	{ 'MU': {'name': 'MAURITIUS','code': '230'} },
	{ 'MV': {'name': 'MALDIVES','code': '960'} },
	{ 'MW': {'name': 'MALAWI','code': '265'} },
	{ 'MX': {'name': 'MEXICO','code': '52'} },
	{ 'MY': {'name': 'MALAYSIA','code': '60'} },
	{ 'MZ': {'name': 'MOZAMBIQUE','code': '258'} },
	{ 'NA': {'name': 'NAMIBIA','code': '264'} },
	{ 'NC': {'name': 'NEW CALEDONIA','code': '687'} },
	{ 'NE': {'name': 'NIGER','code': '227'} },
	{ 'NG': {'name': 'NIGERIA','code': '234'} },
	{ 'NI': {'name': 'NICARAGUA','code': '505'} },
	{ 'NL': {'name': 'NETHERLANDS','code': '31'} },
	{ 'NO': {'name': 'NORWAY','code': '47'} },
	{ 'NP': {'name': 'NEPAL','code': '977'} },
	{ 'NR': {'name': 'NAURU','code': '674'} },
	{ 'NU': {'name': 'NIUE','code': '683'} },
	{ 'NZ': {'name': 'NEW ZEALAND','code': '64'} },
	{ 'OM': {'name': 'OMAN','code': '968'} },
	{ 'PA': {'name': 'PANAMA','code': '507'} },
	{ 'PE': {'name': 'PERU','code': '51'} },
	{ 'PF': {'name': 'FRENCH POLYNESIA','code': '689'} },
	{ 'PG': {'name': 'PAPUA NEW GUINEA','code': '675'} },
	{ 'PH': {'name': 'PHILIPPINES','code': '63'} },
	{ 'PK': {'name': 'PAKISTAN','code': '92'} },
	{ 'PL': {'name': 'POLAND','code': '48'} },
	{ 'PM': {'name': 'SAINT PIERRE AND MIQUELON','code': '508'} },
	{ 'PN': {'name': 'PITCAIRN','code': '870'} },
	{ 'PR': {'name': 'PUERTO RICO','code': '1'} },
	{ 'PT': {'name': 'PORTUGAL','code': '351'} },
	{ 'PW': {'name': 'PALAU','code': '680'} },
	{ 'PY': {'name': 'PARAGUAY','code': '595'} },
	{ 'QA': {'name': 'QATAR','code': '974'} },
	{ 'RO': {'name': 'ROMANIA','code': '40'} },
	{ 'RS': {'name': 'SERBIA','code': '381'} },
	{ 'RU': {'name': 'RUSSIAN FEDERATION','code': '7'} },
	{ 'RW': {'name': 'RWANDA','code': '250'} },
	{ 'SA': {'name': 'SAUDI ARABIA','code': '966'} },
	{ 'SB': {'name': 'SOLOMON ISLANDS','code': '677'} },
	{ 'SC': {'name': 'SEYCHELLES','code': '248'} },
	{ 'SD': {'name': 'SUDAN','code': '249'} },
	{ 'SE': {'name': 'SWEDEN','code': '46'} },
	{ 'SG': {'name': 'SINGAPORE','code': '65'} },
	{ 'SH': {'name': 'SAINT HELENA','code': '290'} },
	{ 'SI': {'name': 'SLOVENIA','code': '386'} },
	{ 'SK': {'name': 'SLOVAKIA','code': '421'} },
	{ 'SL': {'name': 'SIERRA LEONE','code': '232'} },
	{ 'SM': {'name': 'SAN MARINO','code': '378'} },
	{ 'SN': {'name': 'SENEGAL','code': '221'} },
	{ 'SO': {'name': 'SOMALIA','code': '252'} },
	{ 'SR': {'name': 'SURINAME','code': '597'} },
	{ 'ST': {'name': 'SAO TOME AND PRINCIPE','code': '239'} },
	{ 'SV': {'name': 'EL SALVADOR','code': '503'} },
	{ 'SY': {'name': 'SYRIAN ARAB REPUBLIC','code': '963'} },
	{ 'SZ': {'name': 'SWAZILAND','code': '268'} },
	{ 'TC': {'name': 'TURKS AND CAICOS ISLANDS','code': '1649'} },
	{ 'TD': {'name': 'CHAD','code': '235'} },
	{ 'TG': {'name': 'TOGO','code': '228'} },
	{ 'TH': {'name': 'THAILAND','code': '66'} },
	{ 'TJ': {'name': 'TAJIKISTAN','code': '992'} },
	{ 'TK': {'name': 'TOKELAU','code': '690'} },
	{ 'TL': {'name': 'TIMOR-LESTE','code': '670'} },
	{ 'TM': {'name': 'TURKMENISTAN','code': '993'} },
	{ 'TN': {'name': 'TUNISIA','code': '216'} },
	{ 'TO': {'name': 'TONGA','code': '676'} },
	{ 'TR': {'name': 'TURKEY','code': '90'} },
	{ 'TT': {'name': 'TRINIDAD AND TOBAGO','code': '1868'} },
	{ 'TV': {'name': 'TUVALU','code': '688'} },
	{ 'TW': {'name': 'TAIWAN, PROVINCE OF CHINA','code': '886'} },
	{ 'TZ': {'name': 'TANZANIA, UNITED REPUBLIC OF','code': '255'} },
	{ 'UA': {'name': 'UKRAINE','code': '380'} },
	{ 'UG': {'name': 'UGANDA','code': '256'} },
	{ 'US': {'name': 'UNITED STATES','code': '1'} },
	{ 'UY': {'name': 'URUGUAY','code': '598'} },
	{ 'UZ': {'name': 'UZBEKISTAN','code': '998'} },
	{ 'VA': {'name': 'HOLY SEE (VATICAN CITY STATE)','code': '39'} },
	{ 'VC': {'name': 'SAINT VINCENT AND THE GRENADINES','code': '1784'} },
	{ 'VE': {'name': 'VENEZUELA','code': '58'} },
	{ 'VG': {'name': 'VIRGIN ISLANDS, BRITISH','code': '1284'} },
	{ 'VI': {'name': 'VIRGIN ISLANDS, U.S.','code': '1340'} },
	{ 'VN': {'name': 'VIET NAM','code': '84'} },
	{ 'VU': {'name': 'VANUATU','code': '678'} },
	{ 'WF': {'name': 'WALLIS AND FUTUNA','code': '681'} },
	{ 'WS': {'name': 'SAMOA','code': '685'} },
	{ 'XK': {'name': 'KOSOVO','code': '381'} },
	{ 'YE': {'name': 'YEMEN','code': '967'} },
	{ 'YT': {'name': 'MAYOTTE','code': '262'} },
	{ 'ZA': {'name': 'SOUTH AFRICA','code': '27'} },
	{ 'ZM': {'name': 'ZAMBIA','code': '260'} },
	{ 'ZW': {'name': 'ZIMBABWE','code': '263'} }
];

@nejib1
Copy link

nejib1 commented Jan 10, 2019

function getCountryName($countryCode)
{
    $countries = array('AF' => 'Afghanistan', 'AX' => 'Aland 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, Democratic Republic', '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 & 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', 'KR' => 'Korea', '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', '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', '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', 'BL' => 'Saint Barthelemy', 'SH' => 'Saint Helena', 'KN' => 'Saint Kitts And Nevis', 'LC' => 'Saint Lucia', 'MF' => 'Saint Martin', 'PM' => 'Saint Pierre And Miquelon', 'VC' => 'Saint Vincent And 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 Sandwich Isl.', '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', 'TJ' => 'Tajikistan', 'TZ' => 'Tanzania', '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 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');
    if(isset($countries[$countryCode])) return $countries[$countryCode];
        return "Unknown Country";
}

@wajdijurry
Copy link

Thanks alot

@Peace-N
Copy link

Peace-N commented Feb 1, 2019

Excellent thanks saved me so much time

@hdmontero
Copy link

Thank you for this!!!

@taheroo
Copy link

taheroo commented Feb 20, 2019

in case anyone needed it this way :
'Afghanistan' => 'AF',
'Aland Islands' => 'AX',
'Albania' => 'AL',
'Algeria' => 'DZ',
'American Samoa' => 'AS',
'Andorra' => 'AD',
'Angola' => 'AO',
'Anguilla' => 'AI',
'Antarctica' => 'AQ',
'Antigua and Barbuda' => 'AG',
'Argentina' => 'AR',
'Armenia' => 'AM',
'Aruba' => 'AW',
'Australia' => 'AU',
'Austria' => 'AT',
'Azerbaijan' => 'AZ',
'Bahamas' => 'BS',
'Bahrain' => 'BH',
'Bangladesh' => 'BD',
'Barbados' => 'BB',
'Belarus' => 'BY',
'Belgium' => 'BE',
'Belize' => 'BZ',
'Benin' => 'BJ',
'Bermuda' => 'BM',
'Bhutan' => 'BT',
'Bolivia' => 'BO',
'Bonaire, Saint Eustatius and Saba' => 'BQ',
'Bosnia and Herzegovina' => 'BA',
'Botswana' => 'BW',
'Bouvet Island' => 'BV',
'Brazil' => 'BR',
'British Indian Ocean Territory' => 'IO',
'British Virgin Islands' => 'VG',
'Brunei' => 'BN',
'Bulgaria' => 'BG',
'Burkina Faso' => 'BF',
'Burundi' => 'BI',
'Cambodia' => 'KH',
'Cameroon' => 'CM',
'Canada' => 'CA',
'Cape Verde' => 'CV',
'Cayman Islands' => 'KY',
'Central African Republic' => 'CF',
'Chad' => 'TD',
'Chile' => 'CL',
'China' => 'CN',
'Christmas Island' => 'CX',
'Cocos Islands' => 'CC',
'Colombia' => 'CO',
'Comoros' => 'KM',
'Cook Islands' => 'CK',
'Costa Rica' => 'CR',
'Croatia' => 'HR',
'Cuba' => 'CU',
'Curacao' => 'CW',
'Cyprus' => 'CY',
'Czech Republic' => 'CZ',
'Democratic Republic of the Congo' => 'CD',
'Denmark' => 'DK',
'Djibouti' => 'DJ',
'Dominica' => 'DM',
'Dominican Republic' => 'DO',
'East Timor' => 'TL',
'Ecuador' => 'EC',
'Egypt' => 'EG',
'El Salvador' => 'SV',
'Equatorial Guinea' => 'GQ',
'Eritrea' => 'ER',
'Estonia' => 'EE',
'Ethiopia' => 'ET',
'Falkland Islands' => 'FK',
'Faroe Islands' => 'FO',
'Fiji' => 'FJ',
'Finland' => 'FI',
'France' => 'FR',
'French Guiana' => 'GF',
'French Polynesia' => 'PF',
'French Southern Territories' => 'TF',
'Gabon' => 'GA',
'Gambia' => 'GM',
'Georgia' => 'GE',
'Germany' => 'DE',
'Ghana' => 'GH',
'Gibraltar' => 'GI',
'Greece' => 'GR',
'Greenland' => 'GL',
'Grenada' => 'GD',
'Guadeloupe' => 'GP',
'Guam' => 'GU',
'Guatemala' => 'GT',
'Guernsey' => 'GG',
'Guinea' => 'GN',
'Guinea-Bissau' => 'GW',
'Guyana' => 'GY',
'Haiti' => 'HT',
'Heard Island and McDonald Islands' => 'HM',
'Honduras' => 'HN',
'Hong Kong' => 'HK',
'Hungary' => 'HU',
'Iceland' => 'IS',
'India' => 'IN',
'Indonesia' => 'ID',
'Iran' => 'IR',
'Iraq' => 'IQ',
'Ireland' => 'IE',
'Isle of Man' => 'IM',
'Israel' => 'IL',
'Italy' => 'IT',
'Ivory Coast' => 'CI',
'Jamaica' => 'JM',
'Japan' => 'JP',
'Jersey' => 'JE',
'Jordan' => 'JO',
'Kazakhstan' => 'KZ',
'Kenya' => 'KE',
'Kiribati' => 'KI',
'Kosovo' => 'XK',
'Kuwait' => 'KW',
'Kyrgyzstan' => 'KG',
'Laos' => 'LA',
'Latvia' => 'LV',
'Lebanon' => 'LB',
'Lesotho' => 'LS',
'Liberia' => 'LR',
'Libya' => 'LY',
'Liechtenstein' => 'LI',
'Lithuania' => 'LT',
'Luxembourg' => 'LU',
'Macao' => 'MO',
'Macedonia' => 'MK',
'Madagascar' => 'MG',
'Malawi' => 'MW',
'Malaysia' => 'MY',
'Maldives' => 'MV',
'Mali' => 'ML',
'Malta' => 'MT',
'Marshall Islands' => 'MH',
'Martinique' => 'MQ',
'Mauritania' => 'MR',
'Mauritius' => 'MU',
'Mayotte' => 'YT',
'Mexico' => 'MX',
'Micronesia' => 'FM',
'Moldova' => 'MD',
'Monaco' => 'MC',
'Mongolia' => 'MN',
'Montenegro' => 'ME',
'Montserrat' => 'MS',
'Morocco' => 'MA',
'Mozambique' => 'MZ',
'Myanmar' => 'MM',
'Namibia' => 'NA',
'Nauru' => 'NR',
'Nepal' => 'NP',
'Netherlands' => 'NL',
'New Caledonia' => 'NC',
'New Zealand' => 'NZ',
'Nicaragua' => 'NI',
'Niger' => 'NE',
'Nigeria' => 'NG',
'Niue' => 'NU',
'Norfolk Island' => 'NF',
'North Korea' => 'KP',
'Northern Mariana Islands' => 'MP',
'Norway' => 'NO',
'Oman' => 'OM',
'Pakistan' => 'PK',
'Palau' => 'PW',
'Palestinian Territory' => 'PS',
'Panama' => 'PA',
'Papua New Guinea' => 'PG',
'Paraguay' => 'PY',
'Peru' => 'PE',
'Philippines' => 'PH',
'Pitcairn' => 'PN',
'Poland' => 'PL',
'Portugal' => 'PT',
'Puerto Rico' => 'PR',
'Qatar' => 'QA',
'Republic of the Congo' => 'CG',
'Reunion' => 'RE',
'Romania' => 'RO',
'Russia' => 'RU',
'Rwanda' => 'RW',
'Saint Barthelemy' => 'BL',
'Saint Helena' => 'SH',
'Saint Kitts and Nevis' => 'KN',
'Saint Lucia' => 'LC',
'Saint Martin' => 'MF',
'Saint Pierre and Miquelon' => 'PM',
'Saint Vincent and the Grenadines' => 'VC',
'Samoa' => 'WS',
'San Marino' => 'SM',
'Sao Tome and Principe' => 'ST',
'Saudi Arabia' => 'SA',
'Senegal' => 'SN',
'Serbia' => 'RS',
'Seychelles' => 'SC',
'Sierra Leone' => 'SL',
'Singapore' => 'SG',
'Sint Maarten' => 'SX',
'Slovakia' => 'SK',
'Slovenia' => 'SI',
'Solomon Islands' => 'SB',
'Somalia' => 'SO',
'South Africa' => 'ZA',
'South Georgia and the South Sandwich Islands' => 'GS',
'South Korea' => 'KR',
'South Sudan' => 'SS',
'Spain' => 'ES',
'Sri Lanka' => 'LK',
'Sudan' => 'SD',
'Suriname' => 'SR',
'Svalbard and Jan Mayen' => 'SJ',
'Swaziland' => 'SZ',
'Sweden' => 'SE',
'Switzerland' => 'CH',
'Syria' => 'SY',
'Taiwan' => 'TW',
'Tajikistan' => 'TJ',
'Tanzania' => 'TZ',
'Thailand' => 'TH',
'Togo' => 'TG',
'Tokelau' => 'TK',
'Tonga' => 'TO',
'Trinidad and Tobago' => 'TT',
'Tunisia' => 'TN',
'Turkey' => 'TR',
'Turkmenistan' => 'TM',
'Turks and Caicos Islands' => 'TC',
'Tuvalu' => 'TV',
'U.S. Virgin Islands' => 'VI',
'Uganda' => 'UG',
'Ukraine' => 'UA',
'United Arab Emirates' => 'AE',
'United Kingdom' => 'GB',
'United States' => 'US',
'United States Minor Outlying Islands' => 'UM',
'Uruguay' => 'UY',
'Uzbekistan' => 'UZ',
'Vanuatu' => 'VU',
'Vatican' => 'VA',
'Venezuela' => 'VE',
'Vietnam' => 'VN',
'Wallis and Futuna' => 'WF',
'Western Sahara' => 'EH',
'Yemen' => 'YE',
'Zambia' => 'ZM',
'Zimbabwe' => 'ZW',

@azot87137
Copy link

Thanks

@botaniQQQ
Copy link

botaniQQQ commented Mar 10, 2019

let iso_3166_1 = ['AD','AE','AF','AG','AI','AL','AM','AO','AQ','AR','AS','AT','AU','AW','AX','AZ','BA','BB','BD','BE','BF','BG','BH','BI','BJ','BL','BM','BN','BO','BQ','BR','BS','BT','BV','BW','BY','BZ','CA','CC','CD','CF','CG','CH','CI','CK','CL','CM','CN','CO','CR','CU','CV','CW','CX','CY','CZ','DE','DJ','DK','DM','DO','DZ','EC','EE','EG','EH','ER','ES','ET','FI','FJ','FK','FM','FO','FR','GA','GB','GD','GE','GF','GG','GH','GI','GL','GM','GN','GP','GQ','GR','GS','GT','GU','GW','GY','HK','HM','HN','HR','HT','HU','ID','IE','IL','IM','IN','IO','IQ','IR','IS','IT','JE','JM','JO','JP','KE','KG','KH','KI','KM','KN','KP','KR','KW','KY','KZ','LA','LB','LC','LI','LK','LR','LS','LT','LU','LV','LY','MA','MC','MD','ME','MF','MG','MH','MK','ML','MM','MN','MO','MP','MQ','MR','MS','MT','MU','MV','MW','MX','MY','MZ','NA','NC','NE','NF','NG','NI','NL','NO','NP','NR','NU','NZ','OM','PA','PE','PF','PG','PH','PK','PL','PM','PN','PR','PS','PT','PW','PY','QA','RE','RO','RS','RU','RW','SA','SB','SC','SD','SE','SG','SH','SI','SJ','SK','SL','SM','SN','SO','SR','SS','ST','SV','SX','SY','SZ','TC','TD','TF','TG','TH','TJ','TK','TL','TM','TN','TO','TR','TT','TV','TW','TZ','UA','UG','UM','US','UY','UZ','VA','VC','VE','VG','VI','VN','VU','WF','WS','YE','YT','ZA','ZM','ZW'];

@javanmohamad
Copy link

Thank you all

@MikaSchmidt
Copy link

lifesaver!

@McMazalf
Copy link

in case anyone needed it this way :
'Afghanistan' => 'AF',
'Aland Islands' => 'AX',
'Albania' => 'AL',
'Algeria' => 'DZ',
'American Samoa' => 'AS',
'Andorra' => 'AD',
'Angola' => 'AO',
'Anguilla' => 'AI',
'Antarctica' => 'AQ',
'Antigua and Barbuda' => 'AG',
'Argentina' => 'AR',
'Armenia' => 'AM',
'Aruba' => 'AW',
'Australia' => 'AU',
'Austria' => 'AT',
'Azerbaijan' => 'AZ',
'Bahamas' => 'BS',
'Bahrain' => 'BH',
'Bangladesh' => 'BD',
'Barbados' => 'BB',
'Belarus' => 'BY',
'Belgium' => 'BE',
'Belize' => 'BZ',
'Benin' => 'BJ',
'Bermuda' => 'BM',
'Bhutan' => 'BT',
'Bolivia' => 'BO',
'Bonaire, Saint Eustatius and Saba' => 'BQ',
'Bosnia and Herzegovina' => 'BA',
'Botswana' => 'BW',
'Bouvet Island' => 'BV',
'Brazil' => 'BR',
'British Indian Ocean Territory' => 'IO',
'British Virgin Islands' => 'VG',
'Brunei' => 'BN',
'Bulgaria' => 'BG',
'Burkina Faso' => 'BF',
'Burundi' => 'BI',
'Cambodia' => 'KH',
'Cameroon' => 'CM',
'Canada' => 'CA',
'Cape Verde' => 'CV',
'Cayman Islands' => 'KY',
'Central African Republic' => 'CF',
'Chad' => 'TD',
'Chile' => 'CL',
'China' => 'CN',
'Christmas Island' => 'CX',
'Cocos Islands' => 'CC',
'Colombia' => 'CO',
'Comoros' => 'KM',
'Cook Islands' => 'CK',
'Costa Rica' => 'CR',
'Croatia' => 'HR',
'Cuba' => 'CU',
'Curacao' => 'CW',
'Cyprus' => 'CY',
'Czech Republic' => 'CZ',
'Democratic Republic of the Congo' => 'CD',
'Denmark' => 'DK',
'Djibouti' => 'DJ',
'Dominica' => 'DM',
'Dominican Republic' => 'DO',
'East Timor' => 'TL',
'Ecuador' => 'EC',
'Egypt' => 'EG',
'El Salvador' => 'SV',
'Equatorial Guinea' => 'GQ',
'Eritrea' => 'ER',
'Estonia' => 'EE',
'Ethiopia' => 'ET',
'Falkland Islands' => 'FK',
'Faroe Islands' => 'FO',
'Fiji' => 'FJ',
'Finland' => 'FI',
'France' => 'FR',
'French Guiana' => 'GF',
'French Polynesia' => 'PF',
'French Southern Territories' => 'TF',
'Gabon' => 'GA',
'Gambia' => 'GM',
'Georgia' => 'GE',
'Germany' => 'DE',
'Ghana' => 'GH',
'Gibraltar' => 'GI',
'Greece' => 'GR',
'Greenland' => 'GL',
'Grenada' => 'GD',
'Guadeloupe' => 'GP',
'Guam' => 'GU',
'Guatemala' => 'GT',
'Guernsey' => 'GG',
'Guinea' => 'GN',
'Guinea-Bissau' => 'GW',
'Guyana' => 'GY',
'Haiti' => 'HT',
'Heard Island and McDonald Islands' => 'HM',
'Honduras' => 'HN',
'Hong Kong' => 'HK',
'Hungary' => 'HU',
'Iceland' => 'IS',
'India' => 'IN',
'Indonesia' => 'ID',
'Iran' => 'IR',
'Iraq' => 'IQ',
'Ireland' => 'IE',
'Isle of Man' => 'IM',
'Israel' => 'IL',
'Italy' => 'IT',
'Ivory Coast' => 'CI',
'Jamaica' => 'JM',
'Japan' => 'JP',
'Jersey' => 'JE',
'Jordan' => 'JO',
'Kazakhstan' => 'KZ',
'Kenya' => 'KE',
'Kiribati' => 'KI',
'Kosovo' => 'XK',
'Kuwait' => 'KW',
'Kyrgyzstan' => 'KG',
'Laos' => 'LA',
'Latvia' => 'LV',
'Lebanon' => 'LB',
'Lesotho' => 'LS',
'Liberia' => 'LR',
'Libya' => 'LY',
'Liechtenstein' => 'LI',
'Lithuania' => 'LT',
'Luxembourg' => 'LU',
'Macao' => 'MO',
'Macedonia' => 'MK',
'Madagascar' => 'MG',
'Malawi' => 'MW',
'Malaysia' => 'MY',
'Maldives' => 'MV',
'Mali' => 'ML',
'Malta' => 'MT',
'Marshall Islands' => 'MH',
'Martinique' => 'MQ',
'Mauritania' => 'MR',
'Mauritius' => 'MU',
'Mayotte' => 'YT',
'Mexico' => 'MX',
'Micronesia' => 'FM',
'Moldova' => 'MD',
'Monaco' => 'MC',
'Mongolia' => 'MN',
'Montenegro' => 'ME',
'Montserrat' => 'MS',
'Morocco' => 'MA',
'Mozambique' => 'MZ',
'Myanmar' => 'MM',
'Namibia' => 'NA',
'Nauru' => 'NR',
'Nepal' => 'NP',
'Netherlands' => 'NL',
'New Caledonia' => 'NC',
'New Zealand' => 'NZ',
'Nicaragua' => 'NI',
'Niger' => 'NE',
'Nigeria' => 'NG',
'Niue' => 'NU',
'Norfolk Island' => 'NF',
'North Korea' => 'KP',
'Northern Mariana Islands' => 'MP',
'Norway' => 'NO',
'Oman' => 'OM',
'Pakistan' => 'PK',
'Palau' => 'PW',
'Palestinian Territory' => 'PS',
'Panama' => 'PA',
'Papua New Guinea' => 'PG',
'Paraguay' => 'PY',
'Peru' => 'PE',
'Philippines' => 'PH',
'Pitcairn' => 'PN',
'Poland' => 'PL',
'Portugal' => 'PT',
'Puerto Rico' => 'PR',
'Qatar' => 'QA',
'Republic of the Congo' => 'CG',
'Reunion' => 'RE',
'Romania' => 'RO',
'Russia' => 'RU',
'Rwanda' => 'RW',
'Saint Barthelemy' => 'BL',
'Saint Helena' => 'SH',
'Saint Kitts and Nevis' => 'KN',
'Saint Lucia' => 'LC',
'Saint Martin' => 'MF',
'Saint Pierre and Miquelon' => 'PM',
'Saint Vincent and the Grenadines' => 'VC',
'Samoa' => 'WS',
'San Marino' => 'SM',
'Sao Tome and Principe' => 'ST',
'Saudi Arabia' => 'SA',
'Senegal' => 'SN',
'Serbia' => 'RS',
'Seychelles' => 'SC',
'Sierra Leone' => 'SL',
'Singapore' => 'SG',
'Sint Maarten' => 'SX',
'Slovakia' => 'SK',
'Slovenia' => 'SI',
'Solomon Islands' => 'SB',
'Somalia' => 'SO',
'South Africa' => 'ZA',
'South Georgia and the South Sandwich Islands' => 'GS',
'South Korea' => 'KR',
'South Sudan' => 'SS',
'Spain' => 'ES',
'Sri Lanka' => 'LK',
'Sudan' => 'SD',
'Suriname' => 'SR',
'Svalbard and Jan Mayen' => 'SJ',
'Swaziland' => 'SZ',
'Sweden' => 'SE',
'Switzerland' => 'CH',
'Syria' => 'SY',
'Taiwan' => 'TW',
'Tajikistan' => 'TJ',
'Tanzania' => 'TZ',
'Thailand' => 'TH',
'Togo' => 'TG',
'Tokelau' => 'TK',
'Tonga' => 'TO',
'Trinidad and Tobago' => 'TT',
'Tunisia' => 'TN',
'Turkey' => 'TR',
'Turkmenistan' => 'TM',
'Turks and Caicos Islands' => 'TC',
'Tuvalu' => 'TV',
'U.S. Virgin Islands' => 'VI',
'Uganda' => 'UG',
'Ukraine' => 'UA',
'United Arab Emirates' => 'AE',
'United Kingdom' => 'GB',
'United States' => 'US',
'United States Minor Outlying Islands' => 'UM',
'Uruguay' => 'UY',
'Uzbekistan' => 'UZ',
'Vanuatu' => 'VU',
'Vatican' => 'VA',
'Venezuela' => 'VE',
'Vietnam' => 'VN',
'Wallis and Futuna' => 'WF',
'Western Sahara' => 'EH',
'Yemen' => 'YE',
'Zambia' => 'ZM',
'Zimbabwe' => 'ZW',

Thank you very much <3

@vanvantsyan
Copy link

'Afghanistan' => 'AF',
'Aland Islands' => 'AX',
'Albania' => 'AL',
'Algeria' => 'DZ',
'American Samoa' => 'AS',
'Andorra' => 'AD',
'Angola' => 'AO',
'Anguilla' => 'AI',
'Antarctica' => 'AQ',
'Antigua and Barbuda' => 'AG',
'Argentina' => 'AR',
'Armenia' => 'AM',
'Aruba' => 'AW',
'Australia' => 'AU',
'Austria' => 'AT',
'Azerbaijan' => 'AZ',
'Bahamas' => 'BS',
'Bahrain' => 'BH',
'Bangladesh' => 'BD',
'Barbados' => 'BB',
'Belarus' => 'BY',
'Belgium' => 'BE',
'Belize' => 'BZ',
'Benin' => 'BJ',
'Bermuda' => 'BM',
'Bhutan' => 'BT',
'Bolivia' => 'BO',
'Bonaire, Saint Eustatius and Saba' => 'BQ',
'Bosnia and Herzegovina' => 'BA',
'Botswana' => 'BW',
'Bouvet Island' => 'BV',
'Brazil' => 'BR',
'British Indian Ocean Territory' => 'IO',
'British Virgin Islands' => 'VG',
'Brunei' => 'BN',
'Bulgaria' => 'BG',
'Burkina Faso' => 'BF',
'Burundi' => 'BI',
'Cambodia' => 'KH',
'Cameroon' => 'CM',
'Canada' => 'CA',
'Cape Verde' => 'CV',
'Cayman Islands' => 'KY',
'Central African Republic' => 'CF',
'Chad' => 'TD',
'Chile' => 'CL',
'China' => 'CN',
'Christmas Island' => 'CX',
'Cocos Islands' => 'CC',
'Colombia' => 'CO',
'Comoros' => 'KM',
'Cook Islands' => 'CK',
'Costa Rica' => 'CR',
'Croatia' => 'HR',
'Cuba' => 'CU',
'Curacao' => 'CW',
'Cyprus' => 'CY',
'Czech Republic' => 'CZ',
'Democratic Republic of the Congo' => 'CD',
'Denmark' => 'DK',
'Djibouti' => 'DJ',
'Dominica' => 'DM',
'Dominican Republic' => 'DO',
'East Timor' => 'TL',
'Ecuador' => 'EC',
'Egypt' => 'EG',
'El Salvador' => 'SV',
'Equatorial Guinea' => 'GQ',
'Eritrea' => 'ER',
'Estonia' => 'EE',
'Ethiopia' => 'ET',
'Falkland Islands' => 'FK',
'Faroe Islands' => 'FO',
'Fiji' => 'FJ',
'Finland' => 'FI',
'France' => 'FR',
'French Guiana' => 'GF',
'French Polynesia' => 'PF',
'French Southern Territories' => 'TF',
'Gabon' => 'GA',
'Gambia' => 'GM',
'Georgia' => 'GE',
'Germany' => 'DE',
'Ghana' => 'GH',
'Gibraltar' => 'GI',
'Greece' => 'GR',
'Greenland' => 'GL',
'Grenada' => 'GD',
'Guadeloupe' => 'GP',
'Guam' => 'GU',
'Guatemala' => 'GT',
'Guernsey' => 'GG',
'Guinea' => 'GN',
'Guinea-Bissau' => 'GW',
'Guyana' => 'GY',
'Haiti' => 'HT',
'Heard Island and McDonald Islands' => 'HM',
'Honduras' => 'HN',
'Hong Kong' => 'HK',
'Hungary' => 'HU',
'Iceland' => 'IS',
'India' => 'IN',
'Indonesia' => 'ID',
'Iran' => 'IR',
'Iraq' => 'IQ',
'Ireland' => 'IE',
'Isle of Man' => 'IM',
'Israel' => 'IL',
'Italy' => 'IT',
'Ivory Coast' => 'CI',
'Jamaica' => 'JM',
'Japan' => 'JP',
'Jersey' => 'JE',
'Jordan' => 'JO',
'Kazakhstan' => 'KZ',
'Kenya' => 'KE',
'Kiribati' => 'KI',
'Kosovo' => 'XK',
'Kuwait' => 'KW',
'Kyrgyzstan' => 'KG',
'Laos' => 'LA',
'Latvia' => 'LV',
'Lebanon' => 'LB',
'Lesotho' => 'LS',
'Liberia' => 'LR',
'Libya' => 'LY',
'Liechtenstein' => 'LI',
'Lithuania' => 'LT',
'Luxembourg' => 'LU',
'Macao' => 'MO',
'Macedonia' => 'MK',
'Madagascar' => 'MG',
'Malawi' => 'MW',
'Malaysia' => 'MY',
'Maldives' => 'MV',
'Mali' => 'ML',
'Malta' => 'MT',
'Marshall Islands' => 'MH',
'Martinique' => 'MQ',
'Mauritania' => 'MR',
'Mauritius' => 'MU',
'Mayotte' => 'YT',
'Mexico' => 'MX',
'Micronesia' => 'FM',
'Moldova' => 'MD',
'Monaco' => 'MC',
'Mongolia' => 'MN',
'Montenegro' => 'ME',
'Montserrat' => 'MS',
'Morocco' => 'MA',
'Mozambique' => 'MZ',
'Myanmar' => 'MM',
'Namibia' => 'NA',
'Nauru' => 'NR',
'Nepal' => 'NP',
'Netherlands' => 'NL',
'New Caledonia' => 'NC',
'New Zealand' => 'NZ',
'Nicaragua' => 'NI',
'Niger' => 'NE',
'Nigeria' => 'NG',
'Niue' => 'NU',
'Norfolk Island' => 'NF',
'North Korea' => 'KP',
'Northern Mariana Islands' => 'MP',
'Norway' => 'NO',
'Oman' => 'OM',
'Pakistan' => 'PK',
'Palau' => 'PW',
'Palestinian Territory' => 'PS',
'Panama' => 'PA',
'Papua New Guinea' => 'PG',
'Paraguay' => 'PY',
'Peru' => 'PE',
'Philippines' => 'PH',
'Pitcairn' => 'PN',
'Poland' => 'PL',
'Portugal' => 'PT',
'Puerto Rico' => 'PR',
'Qatar' => 'QA',
'Republic of the Congo' => 'CG',
'Reunion' => 'RE',
'Romania' => 'RO',
'Russia' => 'RU',
'Rwanda' => 'RW',
'Saint Barthelemy' => 'BL',
'Saint Helena' => 'SH',
'Saint Kitts and Nevis' => 'KN',
'Saint Lucia' => 'LC',
'Saint Martin' => 'MF',
'Saint Pierre and Miquelon' => 'PM',
'Saint Vincent and the Grenadines' => 'VC',
'Samoa' => 'WS',
'San Marino' => 'SM',
'Sao Tome and Principe' => 'ST',
'Saudi Arabia' => 'SA',
'Senegal' => 'SN',
'Serbia' => 'RS',
'Seychelles' => 'SC',
'Sierra Leone' => 'SL',
'Singapore' => 'SG',
'Sint Maarten' => 'SX',
'Slovakia' => 'SK',
'Slovenia' => 'SI',
'Solomon Islands' => 'SB',
'Somalia' => 'SO',
'South Africa' => 'ZA',
'South Georgia and the South Sandwich Islands' => 'GS',
'South Korea' => 'KR',
'South Sudan' => 'SS',
'Spain' => 'ES',
'Sri Lanka' => 'LK',
'Sudan' => 'SD',
'Suriname' => 'SR',
'Svalbard and Jan Mayen' => 'SJ',
'Swaziland' => 'SZ',
'Sweden' => 'SE',
'Switzerland' => 'CH',
'Syria' => 'SY',
'Taiwan' => 'TW',
'Tajikistan' => 'TJ',
'Tanzania' => 'TZ',
'Thailand' => 'TH',
'Togo' => 'TG',
'Tokelau' => 'TK',
'Tonga' => 'TO',
'Trinidad and Tobago' => 'TT',
'Tunisia' => 'TN',
'Turkey' => 'TR',
'Turkmenistan' => 'TM',
'Turks and Caicos Islands' => 'TC',
'Tuvalu' => 'TV',
'U.S. Virgin Islands' => 'VI',
'Uganda' => 'UG',
'Ukraine' => 'UA',
'United Arab Emirates' => 'AE',
'United Kingdom' => 'GB',
'United States' => 'US',
'United States Minor Outlying Islands' => 'UM',
'Uruguay' => 'UY',
'Uzbekistan' => 'UZ',
'Vanuatu' => 'VU',
'Vatican' => 'VA',
'Venezuela' => 'VE',
'Vietnam' => 'VN',
'Wallis and Futuna' => 'WF',
'Western Sahara' => 'EH',
'Yemen' => 'YE',
'Zambia' => 'ZM',
'Zimbabwe' => 'ZW',

thankssssssss

@sudarshann
Copy link

sudarshann commented Mar 16, 2020

To render as a select option with a selected country

function get_countries_options($selected_country) {
        
        $options = '';
        $selected = '';
        $countries = array
            (
            'AF' => 'Afghanistan',
            'AX' => 'Aland 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, Democratic Republic',
            '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 & 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',
            'KR' => 'Korea',
            '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',
            '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',
            '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',
            'BL' => 'Saint Barthelemy',
            'SH' => 'Saint Helena',
            'KN' => 'Saint Kitts And Nevis',
            'LC' => 'Saint Lucia',
            'MF' => 'Saint Martin',
            'PM' => 'Saint Pierre And Miquelon',
            'VC' => 'Saint Vincent And 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 Sandwich Isl.',
            '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',
            'TJ' => 'Tajikistan',
            'TZ' => 'Tanzania',
            '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 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',
        );
        
        foreach ($countries as $code => $country_name) {
           if($selected_country === $code){
                $selected = 'selected="selected"';
                $options .= '<option value="' . $code . '" ' . $selected . ' >'. $country_name . '</option>';
            } else {
                $options .= '<option value="' . $code . '" >'. $country_name . '</option>';
            }
        }
        return $options;

@NanJerry
Copy link

Thanks a lot! This really helps me. Can I copy your code and put it in my codes?

@franolg
Copy link

franolg commented Feb 27, 2021

Thanks a lot bro

@cscottsa
Copy link

cscottsa commented Jul 12, 2021

const countryCodes = [{
    code: "AD",
    name: "ANDORRA"
  }, {
    code: "AE",
    name: "UNITED ARAB EMIRATES"
  }, {
    code: "AF",
    name: "AFGHANISTAN"
  }, {
    code: "AG",
    name: "ANTIGUA AND BARBUDA"
  }, {
    code: "AI",
    name: "ANGUILLA"
  }, {
    code: "AL",
    name: "ALBANIA"
  }, {
    code: "AM",
    name: "ARMENIA"
  }, {
    code: "AN",
    name: "NETHERLANDS ANTILLES"
  }, {
    code: "AO",
    name: "ANGOLA"
  }, {
    code: "AQ",
    name: "ANTARCTICA"
  }, {
    code: "AR",
    name: "ARGENTINA"
  }, {
    code: "AS",
    name: "AMERICAN SAMOA"
  }, {
    code: "AT",
    name: "AUSTRIA"
  }, {
    code: "AU",
    name: "AUSTRALIA"
  }, {
    code: "AW",
    name: "ARUBA"
  }, {
    code: "AZ",
    name: "AZERBAIJAN"
  }, {
    code: "BA",
    name: "BOSNIA AND HERZEGOVINA"
  }, {
    code: "BB",
    name: "BARBADOS"
  }, {
    code: "BD",
    name: "BANGLADESH"
  }, {
    code: "BE",
    name: "BELGIUM"
  }, {
    code: "BF",
    name: "BURKINA FASO"
  }, {
    code: "BG",
    name: "BULGARIA"
  }, {
    code: "BH",
    name: "BAHRAIN"
  }, {
    code: "BI",
    name: "BURUNDI"
  }, {
    code: "BJ",
    name: "BENIN"
  }, {
    code: "BL",
    name: "SAINT BARTHELEMY"
  }, {
    code: "BM",
    name: "BERMUDA"
  }, {
    code: "BN",
    name: "BRUNEI DARUSSALAM"
  }, {
    code: "BO",
    name: "BOLIVIA"
  }, {
    code: "BR",
    name: "BRAZIL"
  }, {
    code: "BS",
    name: "BAHAMAS"
  }, {
    code: "BT",
    name: "BHUTAN"
  }, {
    code: "BW",
    name: "BOTSWANA"
  }, {
    code: "BY",
    name: "BELARUS"
  }, {
    code: "BZ",
    name: "BELIZE"
  }, {
    code: "CA",
    name: "CANADA"
  }, {
    code: "CC",
    name: "COCOS (KEELING) ISLANDS"
  }, {
    code: "CD",
    name: "CONGO, THE DEMOCRATIC REPUBLIC OF THE"
  }, {
    code: "CF",
    name: "CENTRAL AFRICAN REPUBLIC"
  }, {
    code: "CG",
    name: "CONGO"
  }, {
    code: "CH",
    name: "SWITZERLAND"
  }, {
    code: "CI",
    name: "COTE D IVOIRE"
  }, {
    code: "CK",
    name: "COOK ISLANDS"
  }, {
    code: "CL",
    name: "CHILE"
  }, {
    code: "CM",
    name: "CAMEROON"
  }, {
    code: "CN",
    name: "CHINA"
  }, {
    code: "CO",
    name: "COLOMBIA"
  }, {
    code: "CR",
    name: "COSTA RICA"
  }, {
    code: "CU",
    name: "CUBA"
  }, {
    code: "CV",
    name: "CAPE VERDE"
  }, {
    code: "CX",
    name: "CHRISTMAS ISLAND"
  }, {
    code: "CY",
    name: "CYPRUS"
  }, {
    code: "CZ",
    name: "CZECH REPUBLIC"
  }, {
    code: "DE",
    name: "GERMANY"
  }, {
    code: "DJ",
    name: "DJIBOUTI"
  }, {
    code: "DK",
    name: "DENMARK"
  }, {
    code: "DM",
    name: "DOMINICA"
  }, {
    code: "DO",
    name: "DOMINICAN REPUBLIC"
  }, {
    code: "DZ",
    name: "ALGERIA"
  }, {
    code: "EC",
    name: "ECUADOR"
  }, {
    code: "EE",
    name: "ESTONIA"
  }, {
    code: "EG",
    name: "EGYPT"
  }, {
    code: "ER",
    name: "ERITREA"
  }, {
    code: "ES",
    name: "SPAIN"
  }, {
    code: "ET",
    name: "ETHIOPIA"
  }, {
    code: "FI",
    name: "FINLAND"
  }, {
    code: "FJ",
    name: "FIJI"
  }, {
    code: "FK",
    name: "FALKLAND ISLANDS (MALVINAS)"
  }, {
    code: "FM",
    name: "MICRONESIA, FEDERATED STATES OF"
  }, {
    code: "FO",
    name: "FAROE ISLANDS"
  }, {
    code: "FR",
    name: "FRANCE"
  }, {
    code: "GA",
    name: "GABON"
  }, {
    code: "GB",
    name: "UNITED KINGDOM"
  }, {
    code: "GD",
    name: "GRENADA"
  }, {
    code: "GE",
    name: "GEORGIA"
  }, {
    code: "GH",
    name: "GHANA"
  }, {
    code: "GI",
    name: "GIBRALTAR"
  }, {
    code: "GL",
    name: "GREENLAND"
  }, {
    code: "GM",
    name: "GAMBIA"
  }, {
    code: "GN",
    name: "GUINEA"
  }, {
    code: "GQ",
    name: "EQUATORIAL GUINEA"
  }, {
    code: "GR",
    name: "GREECE"
  }, {
    code: "GT",
    name: "GUATEMALA"
  }, {
    code: "GU",
    name: "GUAM"
  }, {
    code: "GW",
    name: "GUINEA-BISSAU"
  }, {
    code: "GY",
    name: "GUYANA"
  }, {
    code: "HK",
    name: "HONG KONG"
  }, {
    code: "HN",
    name: "HONDURAS"
  }, {
    code: "HR",
    name: "CROATIA"
  }, {
    code: "HT",
    name: "HAITI"
  }, {
    code: "HU",
    name: "HUNGARY"
  }, {
    code: "ID",
    name: "INDONESIA"
  }, {
    code: "IE",
    name: "IRELAND"
  }, {
    code: "IL",
    name: "ISRAEL"
  }, {
    code: "IM",
    name: "ISLE OF MAN"
  }, {
    code: "IN",
    name: "INDIA"
  }, {
    code: "IQ",
    name: "IRAQ"
  }, {
    code: "IR",
    name: "IRAN, ISLAMIC REPUBLIC OF"
  }, {
    code: "IS",
    name: "ICELAND"
  }, {
    code: "IT",
    name: "ITALY"
  }, {
    code: "JM",
    name: "JAMAICA"
  }, {
    code: "JO",
    name: "JORDAN"
  }, {
    code: "JP",
    name: "JAPAN"
  }, {
    code: "KE",
    name: "KENYA"
  }, {
    code: "KG",
    name: "KYRGYZSTAN"
  }, {
    code: "KH",
    name: "CAMBODIA"
  }, {
    code: "KI",
    name: "KIRIBATI"
  }, {
    code: "KM",
    name: "COMOROS"
  }, {
    code: "KN",
    name: "SAINT KITTS AND NEVIS"
  }, {
    code: "KP",
    name: "KOREA DEMOCRATIC PEOPLES REPUBLIC OF"
  }, {
    code: "KR",
    name: "KOREA REPUBLIC OF"
  }, {
    code: "KW",
    name: "KUWAIT"
  }, {
    code: "KY",
    name: "CAYMAN ISLANDS"
  }, {
    code: "KZ",
    name: "KAZAKSTAN"
  }, {
    code: "LA",
    name: "LAO PEOPLES DEMOCRATIC REPUBLIC"
  }, {
    code: "LB",
    name: "LEBANON"
  }, {
    code: "LC",
    name: "SAINT LUCIA"
  }, {
    code: "LI",
    name: "LIECHTENSTEIN"
  }, {
    code: "LK",
    name: "SRI LANKA"
  }, {
    code: "LR",
    name: "LIBERIA"
  }, {
    code: "LS",
    name: "LESOTHO"
  }, {
    code: "LT",
    name: "LITHUANIA"
  }, {
    code: "LU",
    name: "LUXEMBOURG"
  }, {
    code: "LV",
    name: "LATVIA"
  }, {
    code: "LY",
    name: "LIBYAN ARAB JAMAHIRIYA"
  }, {
    code: "MA",
    name: "MOROCCO"
  }, {
    code: "MC",
    name: "MONACO"
  }, {
    code: "MD",
    name: "MOLDOVA, REPUBLIC OF"
  }, {
    code: "ME",
    name: "MONTENEGRO"
  }, {
    code: "MF",
    name: "SAINT MARTIN"
  }, {
    code: "MG",
    name: "MADAGASCAR"
  }, {
    code: "MH",
    name: "MARSHALL ISLANDS"
  }, {
    code: "MK",
    name: "MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF"
  }, {
    code: "ML",
    name: "MALI"
  }, {
    code: "MM",
    name: "MYANMAR"
  }, {
    code: "MN",
    name: "MONGOLIA"
  }, {
    code: "MO",
    name: "MACAU"
  }, {
    code: "MP",
    name: "NORTHERN MARIANA ISLANDS"
  }, {
    code: "MR",
    name: "MAURITANIA"
  }, {
    code: "MS",
    name: "MONTSERRAT"
  }, {
    code: "MT",
    name: "MALTA"
  }, {
    code: "MU",
    name: "MAURITIUS"
  }, {
    code: "MV",
    name: "MALDIVES"
  }, {
    code: "MW",
    name: "MALAWI"
  }, {
    code: "MX",
    name: "MEXICO"
  }, {
    code: "MY",
    name: "MALAYSIA"
  }, {
    code: "MZ",
    name: "MOZAMBIQUE"
  }, {
    code: "NA",
    name: "NAMIBIA"
  }, {
    code: "NC",
    name: "NEW CALEDONIA"
  }, {
    code: "NE",
    name: "NIGER"
  }, {
    code: "NG",
    name: "NIGERIA"
  }, {
    code: "NI",
    name: "NICARAGUA"
  }, {
    code: "NL",
    name: "NETHERLANDS"
  }, {
    code: "NO",
    name: "NORWAY"
  }, {
    code: "NP",
    name: "NEPAL"
  }, {
    code: "NR",
    name: "NAURU"
  }, {
    code: "NU",
    name: "NIUE"
  }, {
    code: "NZ",
    name: "NEW ZEALAND"
  }, {
    code: "OM",
    name: "OMAN"
  }, {
    code: "PA",
    name: "PANAMA"
  }, {
    code: "PE",
    name: "PERU"
  }, {
    code: "PF",
    name: "FRENCH POLYNESIA"
  }, {
    code: "PG",
    name: "PAPUA NEW GUINEA"
  }, {
    code: "PH",
    name: "PHILIPPINES"
  }, {
    code: "PK",
    name: "PAKISTAN"
  }, {
    code: "PL",
    name: "POLAND"
  }, {
    code: "PM",
    name: "SAINT PIERRE AND MIQUELON"
  }, {
    code: "PN",
    name: "PITCAIRN"
  }, {
    code: "PR",
    name: "PUERTO RICO"
  }, {
    code: "PT",
    name: "PORTUGAL"
  }, {
    code: "PW",
    name: "PALAU"
  }, {
    code: "PY",
    name: "PARAGUAY"
  }, {
    code: "QA",
    name: "QATAR"
  }, {
    code: "RO",
    name: "ROMANIA"
  }, {
    code: "RS",
    name: "SERBIA"
  }, {
    code: "RU",
    name: "RUSSIAN FEDERATION"
  }, {
    code: "RW",
    name: "RWANDA"
  }, {
    code: "SA",
    name: "SAUDI ARABIA"
  }, {
    code: "SB",
    name: "SOLOMON ISLANDS"
  }, {
    code: "SC",
    name: "SEYCHELLES"
  }, {
    code: "SD",
    name: "SUDAN"
  }, {
    code: "SE",
    name: "SWEDEN"
  }, {
    code: "SG",
    name: "SINGAPORE"
  }, {
    code: "SH",
    name: "SAINT HELENA"
  }, {
    code: "SI",
    name: "SLOVENIA"
  }, {
    code: "SK",
    name: "SLOVAKIA"
  }, {
    code: "SL",
    name: "SIERRA LEONE"
  }, {
    code: "SM",
    name: "SAN MARINO"
  }, {
    code: "SN",
    name: "SENEGAL"
  }, {
    code: "SO",
    name: "SOMALIA"
  }, {
    code: "SR",
    name: "SURINAME"
  }, {
    code: "ST",
    name: "SAO TOME AND PRINCIPE"
  }, {
    code: "SV",
    name: "EL SALVADOR"
  }, {
    code: "SY",
    name: "SYRIAN ARAB REPUBLIC"
  }, {
    code: "SZ",
    name: "SWAZILAND"
  }, {
    code: "TC",
    name: "TURKS AND CAICOS ISLANDS"
  }, {
    code: "TD",
    name: "CHAD"
  }, {
    code: "TG",
    name: "TOGO"
  }, {
    code: "TH",
    name: "THAILAND"
  }, {
    code: "TJ",
    name: "TAJIKISTAN"
  }, {
    code: "TK",
    name: "TOKELAU"
  }, {
    code: "TL",
    name: "TIMOR-LESTE"
  }, {
    code: "TM",
    name: "TURKMENISTAN"
  }, {
    code: "TN",
    name: "TUNISIA"
  }, {
    code: "TO",
    name: "TONGA"
  }, {
    code: "TR",
    name: "TURKEY"
  }, {
    code: "TT",
    name: "TRINIDAD AND TOBAGO"
  }, {
    code: "TV",
    name: "TUVALU"
  }, {
    code: "TW",
    name: "TAIWAN, PROVINCE OF CHINA"
  }, {
    code: "TZ",
    name: "TANZANIA, UNITED REPUBLIC OF"
  }, {
    code: "UA",
    name: "UKRAINE"
  }, {
    code: "UG",
    name: "UGANDA"
  }, {
    code: "US",
    name: "UNITED STATES"
  }, {
    code: "UY",
    name: "URUGUAY"
  }, {
    code: "UZ",
    name: "UZBEKISTAN"
  }, {
    code: "VA",
    name: "HOLY SEE (VATICAN CITY STATE)"
  }, {
    code: "VC",
    name: "SAINT VINCENT AND THE GRENADINES"
  }, {
    code: "VE",
    name: "VENEZUELA"
  }, {
    code: "VG",
    name: "VIRGIN ISLANDS, BRITISH"
  }, {
    code: "VI",
    name: "VIRGIN ISLANDS, U.S."
  }, {
    code: "VN",
    name: "VIET NAM"
  }, {
    code: "VU",
    name: "VANUATU"
  }, {
    code: "WF",
    name: "WALLIS AND FUTUNA"
  }, {
    code: "WS",
    name: "SAMOA"
  }, {
    code: "XK",
    name: "KOSOVO"
  }, {
    code: "YE",
    name: "YEMEN"
  }, {
    code: "YT",
    name: "MAYOTTE"
  }, {
    code: "ZA",
    name: "SOUTH AFRICA"
  }, {
    code: "ZM",
    name: "ZAMBIA"
  }, {
    code: "ZW",
    name: "ZIMBABWE"
  }];

@amin-mahmoud
Copy link

If it helps

'AF','AX','AL','DZ','AS','AD','AO','AI','AQ','AG','AR','AM','AW','AU','AT','AZ','BS','BH','BD','BB','BY','BE',
'BZ','BJ','BM','BT','BO','BA','BW','BV','BR','IO','BN','BG','BF','BI','KH','CM','CA','CV','KY','CF','TD','CN',
'CX','CC','CO','KM','CG','CD','CK','CR','CI','HR','CU','CZ','DK','DJ','DM','DO','EC','EG','SV','GQ','ER','EE',
'ET','FK','FO','FJ','FR', 'GF','PF','TF','GA','GM','GE','DE', 'GH','GI','GR','GL','GD','GP','GU','GG',
'GN','GW','GY','HT','HM','VA','HN','HK','HU', 'IS','IN','ID','IR','IQ','IM','IL','IT', 'JM', 'JP', 'JE',
'JO', 'KZ', 'KE', 'KI', 'KR', 'KW', 'KG', 'LA', 'LV', 'LB', 'LS', 'LR', 'LY', 'LI', 'LT', 'LU', 'MO', 'MK',
'MG', 'MW', 'MY', 'MV', 'ML', 'MT', 'MH', 'MQ', 'MR', 'MU', 'YT', 'MX', 'FM', 'MD', 'MC', 'MN', 'ME',
'MS', 'MA', 'MZ', 'MM', 'NA', 'NR', 'NP', 'NL', 'AN', 'NC', 'NZ', 'NI', 'NE', 'NG', 'NU', 'NF', 'MP', 'NO', 'OM',
'PK', 'PW', 'PS', 'PA', 'PG', 'PY', 'PE', 'PH', 'PN', 'PL', 'PT', 'PR', 'QA', 'RE', 'RO', 'RU', 'RW', 'BL', 'SH', 'KN',
'LC', 'MF', 'PM', 'VC', 'WS', 'SM', 'ST', 'SA', 'SN', 'RS', 'SC', 'SL', 'SG', 'SK', 'SI', 'SB', 'SO', 'ZA', 'GS', 'ES', 'LK',
'SD', 'SR', 'SJ', 'SZ', 'SE', 'CH', 'SY', 'TW', 'TJ', 'TZ', 'TH', 'TL', 'TG', 'TK', 'TO', 'TT', 'TN', 'TR', 'TM', 'TC', 'TV',
'UG', 'UA', 'AE', 'GB', 'US', 'UM', 'UY', 'UZ', 'VU', 'VE', 'VN', 'VG', 'VI', 'WF', 'EH', 'YE', 'ZM', 'ZW',
'af','ax','al','dz','as','ad','ao','ai','aq','ag','ar','am','aw','au','at','az','bs','bh','bd','bb','by','be',
'bz','bj','bm','bt','bo','ba','bw','bv','br','io','bn','bg','bf','bi','kh','cm','ca','cv','ky','cf','td','cn',
'cx','cc','co','km','cg','cd','ck','cr','ci','hr','cu','cz','dk','dj','dm','do','ec','eg','sv','gq','er','ee',
'et','fk','fo','fj','fr', 'gf','pf','tf','ga','gm','ge','de', 'gh','gi','gr','gl','gd','gp','gu','gg',
'gn','gw','gy','ht','hm','va','hn','hk','hu', 'is','in','id','ir','iq','im','il','it', 'jm', 'jp', 'je',
'jo', 'kz', 'ke', 'ki', 'kr', 'kw', 'kg', 'la', 'lv', 'lb', 'ls', 'lr', 'ly', 'li', 'lt', 'lu', 'mo', 'mk',
'mg', 'mw', 'my', 'mv', 'ml', 'mt', 'mh', 'mq', 'mr', 'mu', 'yt', 'mx', 'fm', 'md', 'mc', 'mn', 'me',
'ms', 'ma', 'mz', 'mm', 'na', 'nr', 'np', 'nl', 'an', 'nc', 'nz', 'ni', 'ne', 'ng', 'nu', 'nf', 'mp', 'no', 'om',
'pk', 'pw', 'ps', 'pa', 'pg', 'py', 'pe', 'ph', 'pn', 'pl', 'pt', 'pr', 'qa', 're', 'ro', 'ru', 'rw', 'bl', 'sh', 'kn',
'lc', 'mf', 'pm', 'vc', 'ws', 'sm', 'st', 'sa', 'sn', 'rs', 'sc', 'sl', 'sg', 'sk', 'si', 'sb', 'so', 'za', 'gs', 'es', 'lk',
'sd', 'sr', 'sj', 'sz', 'se', 'ch', 'sy', 'tw', 'tj', 'tz', 'th', 'tl', 'tg', 'tk', 'to', 'tt', 'tn', 'tr', 'tm', 'tc', 'tv',
'ug', 'ua', 'ae', 'gb', 'us', 'um', 'uy', 'uz', 'vu', 've', 'vn', 'vg', 'vi', 'wf', 'eh', 'ye', 'zm', 'zw'

@caos30
Copy link

caos30 commented Aug 19, 2021

Traducción al castellano (español)... tirando de wikipedia 😛

<?php

$paises = array(
                    'af' => 'Afganistán',
                    'ax' => 'Aland Islands',
                    'al' => 'Albania',
                    'de' => 'Alemania',
                    'dz' => 'Algeria',
                    'ad' => 'Andorra',
                    'ao' => 'Angola',
                    'ai' => 'Anguila',
                    'aq' => 'Antártida',
                    'ag' => 'Antigua y Barbuda',
                    'an' => 'Antillas Neerlandesas',
                    'sa' => 'Arabia Saudí',
                    'ar' => 'Argentina',
                    'am' => 'Armenia',
                    'aw' => 'Aruba',
                    'au' => 'Australia',
                    'at' => 'Austria',
                    'az' => 'Azerbayán',
                    'bs' => 'Bahamas',
                    'bd' => 'Bangladés',
                    'bb' => 'Barbados',
                    'bh' => 'Baréin',
                    'be' => 'Bélgica',
                    'bz' => 'Belice',
                    'bj' => 'Benín',
                    'bm' => 'Bermudas, Islas',
                    'by' => 'Bielorrusia',
                    'bo' => 'Bolivia',
                    'ba' => 'Bosnia y Herzegovina',
                    'bw' => 'Botswana',
                    'bv' => 'Bouvet',
                    'br' => 'Brasil',
                    'bn' => 'Brunéi Darussalam',
                    'bg' => 'Bulgaria',
                    'bf' => 'Burkina Faso',
                    'bi' => 'Burundi',
                    'bt' => 'Bután',
                    'kh' => 'Camboya',
                    'cm' => 'Camerún',
                    'cv' => 'Cabo Verde',
                    'ca' => 'Canadá',
                    'td' => 'Chad',
                    'cl' => 'Chile',
                    'cn' => 'China',
                    'cy' => 'Chipre',
                    'cc' => 'Cocos (Keeling) Islands',
                    'co' => 'Colombia',
                    'km' => 'Comoros',
                    'cg' => 'Congo',
                    'cd' => 'Congo, Rep. Democrática del',
                    'kp' => 'Corea del Norte',
                    'kr' => 'Corea del Sur',
                    'ci' => 'Costa de Marfil',
                    'cr' => 'Costa Rica',
                    'hr' => 'Croacia',
                    'cu' => 'Cuba',
                    'dk' => 'Dinamarca',
                    'dj' => 'Djibouti',
                    'dm' => 'Dominica',
                    'ec' => 'Ecuador',
                    'eg' => 'Egipto',
                    'sv' => 'El Salvador',
                    'ae' => 'Emiratos Árabes Unidos',
                    'er' => 'Eritrea',
                    'sk' => 'Eslovaquia',
                    'si' => 'Eslovenia',
                    'es' => 'España',
                    'us' => 'Estados Unidos de América',
                    'ee' => 'Estonia',
                    'et' => 'Etiopía',
                    'fj' => 'Fiji',
                    'ph' => 'Filipinas',
                    'fi' => 'Finlandia',
                    'fr' => 'Francia',
                    'ga' => 'Gabón',
                    'gm' => 'Gambia',
                    'ge' => 'Georgia',
                    'gh' => 'Ghana',
                    'gi' => 'Gibraltar',
                    'gd' => 'Granada',
                    'gr' => 'Grecia',
                    'gl' => 'Groenlandia',
                    'gp' => 'Guadalupe',
                    'gu' => 'Guam',
                    'gt' => 'Guatemala',
                    'gy' => 'Guayana',
                    'gf' => 'Guayana Francesa',
                    'gg' => 'Guernsey',
                    'gn' => 'Guinea',
                    'gw' => 'Guinea-Bisáu',
                    'gq' => 'Guinea Ecuatorial',
                    'ht' => 'Haití',
                    'hm' => 'Heard Island & Mcdonald Islands',
                    'hn' => 'Honduras',
                    'hk' => 'Hong Kong',
                    'hu' => 'Hungría',
                    'in' => 'India',
                    'id' => 'Indonesia',
                    'ir' => 'Irán, República Islámica de',
                    'iq' => 'Iraq',
                    'ie' => 'Irlanda',
                    'im' => 'Isla de Man',
                    'cx' => 'Isla Navidad',
                    'nf' => 'Isla Norfolk',
                    'is' => 'Islandia',
                    'ky' => 'Islas Caimán',
                    'ck' => 'Islas Cook',
                    'fo' => 'Islas Feroe',
                    'gs' => 'Islas Georgia y Sandwich del Sur',
                    'fk' => 'Islas Malvinas',
                    'mp' => 'Islas Marianas del Norte',
                    'mh' => 'Islas Marshall',
                    'pn' => 'Islas Pitcairn',
                    'sb' => 'Islas Salomón',
                    'tc' => 'Islas Turcas y Caicos',
                    'um' => 'Islas Ultramarinas Menores de los EEEUU',
                    'vg' => 'Islas Vírgenes Británicas',
                    'vi' => 'Islas Vírgenes de los EEUU',
                    'il' => 'Israel',
                    'it' => 'Italia',
                    'jm' => 'Jamaica',
                    'jp' => 'Japón',
                    'je' => 'Jersey',
                    'jo' => 'Jordán',
                    'kz' => 'Kazajistán',
                    'ke' => 'Kenya',
                    'kg' => 'Kirguistán',
                    'ki' => 'Kiribati',
                    'kw' => 'Kuwait',
                    'la' => 'Laos, Rep. Democr. de Lao',
                    'ls' => 'Lesoto',
                    'lv' => 'Letonia',
                    'lb' => 'Líbano',
                    'lr' => 'Liberia',
                    'ly' => 'Libia',
                    'li' => 'Liechtenstein',
                    'lt' => 'Lituania',
                    'lu' => 'Luxemburgo',
                    'mo' => 'Macao',
                    'mk' => 'Macedonia',
                    'mg' => 'Madagascar',
                    'my' => 'Malasia',
                    'mw' => 'Malaui',
                    'mv' => 'Maldivas',
                    'ml' => 'Mali',
                    'mt' => 'Malta',
                    'ma' => 'Marruecos',
                    'mq' => 'Martinica',
                    'mu' => 'Mauricio',
                    'mr' => 'Mauritania',
                    'yt' => 'Mayotte',
                    'mx' => 'México',
                    'fm' => 'Micronesia, Estados Federados de',
                    'md' => 'Moldavia, República de',
                    'mc' => 'Mónaco',
                    'mn' => 'Mongolia',
                    'me' => 'Montenegro',
                    'ms' => 'Montserrat',
                    'mz' => 'Mozambique',
                    'mm' => 'Myanmar, Birmania',
                    'na' => 'Namibia',
                    'nr' => 'Nauru',
                    'np' => 'Nepal',
                    'ni' => 'Nicaragua',
                    'ne' => 'Níger',
                    'ng' => 'Nigeria',
                    'nu' => 'Niue',
                    'no' => 'Noruega',
                    'nc' => 'Nueva Caledonia',
                    'nz' => 'Nueva Zelanda',
                    'om' => 'Omán',
                    'nl' => 'Países Bajos',
                    'pk' => 'Pakistán',
                    'pw' => 'Palau',
                    'ps' => 'Palestina',
                    'pa' => 'Panamá',
                    'pg' => 'Papúa Nueva Guinea',
                    'py' => 'Paraguay',
                    'pe' => 'Perú',
                    'pf' => 'Polinesia Francesa',
                    'pl' => 'Polonia',
                    'pt' => 'Portugal',
                    'pr' => 'Puerto Rico',
                    'qa' => 'Qatar',
                    'gb' => 'Reino Unido',
                    'cf' => 'República Central Africana',
                    'cz' => 'República Checa',
                    'do' => 'República Dominicana',
                    're' => 'Reunión',
                    'rw' => 'Ruanda',
                    'ro' => 'Rumanía',
                    'ru' => 'Rusia',
                    'eh' => 'Sahara Occidental',
                    'ws' => 'Samoa',
                    'as' => 'Samoa Americana',
                    'bl' => 'San Bartolomé',
                    'kn' => 'San Cristóbal y Nieves',
                    'sm' => 'San Marino',
                    'mf' => 'San Martín',
                    'pm' => 'San Pedro y Miquelón',
                    'vc' => 'San Vicente y Las Granadinas',
                    'sh' => 'Santa Elena',
                    'lc' => 'Santa Lucía',
                    'va' => 'Santa Sede (Cd. Estado del Vaticano)',
                    'st' => 'Santo Tomé y Príncipe',
                    'sn' => 'Senegal',
                    'rs' => 'Serbia',
                    'sc' => 'Seychelles',
                    'sl' => 'Sierra Leona',
                    'sg' => 'Singapur',
                    'sy' => 'Siria, Rep. Árabe de',
                    'so' => 'Somalia',
                    'lk' => 'Sri Lanka',
                    'sz' => 'Suazilandia',
                    'za' => 'Sudáfrica',
                    'sd' => 'Sudán',
                    'se' => 'Suecia',
                    'ch' => 'Suiza',
                    'sr' => 'Surinam',
                    'sj' => 'Svalbard y Jan Mayen',
                    'th' => 'Tailandia',
                    'tw' => 'Taiwán',
                    'tz' => 'Tanzania',
                    'tj' => 'Tayikistán',
                    'io' => 'Territorio Británico del Oc. Índico',
                    'tf' => 'Tierras Australes y Antárticas Francesas',
                    'tl' => 'Timor Oriental',
                    'tg' => 'Togo',
                    'tk' => 'Tokelau',
                    'to' => 'Tonga',
                    'tt' => 'Trinidad y Tobago',
                    'tn' => 'Túnez',
                    'tm' => 'Turkmenistán',
                    'tr' => 'Turquía',
                    'tv' => 'Tuvalu',
                    'ua' => 'Ucrania',
                    'ug' => 'Uganda',
                    'uy' => 'Uruguay',
                    'uz' => 'Uzbekistán',
                    'vu' => 'Vanuatu',
                    've' => 'Venezuela',
                    'vn' => 'Vietnam',
                    'wf' => 'Wallis y Futuna',
                    'ye' => 'Yemen',
                    'zm' => 'Zambia',
                    'zw' => 'Zimbabue'
                );
?>
  • Editado 2021-08-19: faltaba traducir Noruega.
  • Editado 2021-08-19: faltaba agregar 'kp' (Corea del Norte) y cambiar 'kr' a Corea del Sur.

@caos30
Copy link

caos30 commented Aug 19, 2021

Array of VAT by country (maximum VAT on the country).
Taken from here (quite outdated... 2012!!): https://economipedia.com/ranking/el-iva-en-el-mundo.html

<?php 

$vat_by_country = array(
            'hu' => 27,
            'hr' => 25,
            'dk' => 25,
            'no' => 25,
            'se' => 25,
            'fi' => 24,
            'is' => 24,
            'ro' => 24,
            'gr' => 23,
            'ie' => 23,
            'pl' => 23,
            'pt' => 23,
            'it' => 22,
            'uy' => 22,
            'ar' => 21,
            'be' => 21,
            'nl' => 21,
            'es' => 21,
            'fr' => 20,
            'ma' => 20,
            'gb' => 20,
            'cl' => 19,
            'de' => 19,
            'br' => 19,
            'pe' => 18,
            'do' => 18,
            'ru' => 18,
            'cn' => 17,
            'mx' => 16,
            'co' => 16,
            'hn' => 15,
            'ni' => 15,
            'in' => 15,
            'za' => 14,
            'bo' => 13,
            'cr' => 13,
            'sv' => 13,
            'ec' => 12,
            'gt' => 12,
            've' => 12,
            'pr' => 11.5,
            'au' => 10,
            'kr' => 10,
            'py' => 10,
            'jp' => 8,
            'ch' => 8,
            'pa' => 7,
            'ca' => 5,
            'us' => 11.7
            );
    }
?>

@stephb9959
Copy link

In case this is useful for anyone, the country codes above for C++..

    struct CountryInfo {
        std::string     code;
        std::string     name;
    };
    
    static const std::vector<CountryInfo> CountryCodes {
        { .code= "US", .name= "United States" },
        { .code= "GB", .name= "United Kingdom" },
        { .code= "CA", .name= "Canada" },
        { .code= "AF", .name= "Afghanistan" },
        { .code= "AX", .name= "Aland Islands" },
        { .code= "AL", .name= "Albania" },
        { .code= "DZ", .name= "Algeria" },
        { .code= "AS", .name= "American Samoa" },
        { .code= "AD", .name= "Andorra" },
        { .code= "AO", .name= "Angola" },
        { .code= "AI", .name= "Anguilla" },
        { .code= "AQ", .name= "Antarctica" },
        { .code= "AG", .name= "Antigua And Barbuda" },
        { .code= "AR", .name= "Argentina" },
        { .code= "AM", .name= "Armenia" },
        { .code= "AN", .name= "Netherlands Antilles" },
        { .code= "AW", .name= "Aruba" },
        { .code= "AU", .name= "Australia" },
        { .code= "AT", .name= "Austria" },
        { .code= "AZ", .name= "Azerbaijan" },
        { .code= "BS", .name= "Bahamas" },
        { .code= "BH", .name= "Bahrain" },
        { .code= "BD", .name= "Bangladesh" },
        { .code= "BB", .name= "Barbados" },
        { .code= "BY", .name= "Belarus" },
        { .code= "BE", .name= "Belgium" },
        { .code= "BZ", .name= "Belize" },
        { .code= "BJ", .name= "Benin" },
        { .code= "BM", .name= "Bermuda" },
        { .code= "BT", .name= "Bhutan" },
        { .code= "BO", .name= "Bolivia" },
        { .code= "BA", .name= "Bosnia And Herzegovina" },
        { .code= "BW", .name= "Botswana" },
        { .code= "BV", .name= "Bouvet Island" },
        { .code= "BR", .name= "Brazil" },
        { .code= "IO", .name= "British Indian Ocean Territory" },
        { .code= "BN", .name= "Brunei Darussalam" },
        { .code= "BG", .name= "Bulgaria" },
        { .code= "BF", .name= "Burkina Faso" },
        { .code= "BI", .name= "Burundi" },
        { .code= "KH", .name= "Cambodia" },
        { .code= "CM", .name= "Cameroon" },
        { .code= "CA", .name= "Canada" },
        { .code= "CV", .name= "Cape Verde" },
        { .code= "KY", .name= "Cayman Islands" },
        { .code= "CF", .name= "Central African Republic" },
        { .code= "TD", .name= "Chad" },
        { .code= "CL", .name= "Chile" },
        { .code= "CN", .name= "China" },
        { .code= "CX", .name= "Christmas Island" },
        { .code= "CC", .name= "Cocos (Keeling) Islands" },
        { .code= "CO", .name= "Colombia" },
        { .code= "KM", .name= "Comoros" },
        { .code= "CG", .name= "Congo" },
        { .code= "CD", .name= "Congo, Democratic Republic" },
        { .code= "CK", .name= "Cook Islands" },
        { .code= "CR", .name= "Costa Rica" },
        { .code= "CI", .name= "Cote D\"Ivoire" },
        { .code= "HR", .name= "Croatia" },
        { .code= "CU", .name= "Cuba" },
        { .code= "CY", .name= "Cyprus" },
        { .code= "CZ", .name= "Czech Republic" },
        { .code= "DK", .name= "Denmark" },
        { .code= "DJ", .name= "Djibouti" },
        { .code= "DM", .name= "Dominica" },
        { .code= "DO", .name= "Dominican Republic" },
        { .code= "EC", .name= "Ecuador" },
        { .code= "EG", .name= "Egypt" },
        { .code= "SV", .name= "El Salvador" },
        { .code= "GQ", .name= "Equatorial Guinea" },
        { .code= "ER", .name= "Eritrea" },
        { .code= "EE", .name= "Estonia" },
        { .code= "ET", .name= "Ethiopia" },
        { .code= "FK", .name= "Falkland Islands (Malvinas)" },
        { .code= "FO", .name= "Faroe Islands" },
        { .code= "FJ", .name= "Fiji" },
        { .code= "FI", .name= "Finland" },
        { .code= "FR", .name= "France" },
        { .code= "GF", .name= "French Guiana" },
        { .code= "PF", .name= "French Polynesia" },
        { .code= "TF", .name= "French Southern Territories" },
        { .code= "GA", .name= "Gabon" },
        { .code= "GM", .name= "Gambia" },
        { .code= "GE", .name= "Georgia" },
        { .code= "DE", .name= "Germany" },
        { .code= "GH", .name= "Ghana" },
        { .code= "GI", .name= "Gibraltar" },
        { .code= "GR", .name= "Greece" },
        { .code= "GL", .name= "Greenland" },
        { .code= "GD", .name= "Grenada" },
        { .code= "GP", .name= "Guadeloupe" },
        { .code= "GU", .name= "Guam" },
        { .code= "GT", .name= "Guatemala" },
        { .code= "GG", .name= "Guernsey" },
        { .code= "GN", .name= "Guinea" },
        { .code= "GW", .name= "Guinea-Bissau" },
        { .code= "GY", .name= "Guyana" },
        { .code= "HT", .name= "Haiti" },
        { .code= "HM", .name= "Heard Island & Mcdonald Islands" },
        { .code= "VA", .name= "Holy See (Vatican City State)" },
        { .code= "HN", .name= "Honduras" },
        { .code= "HK", .name= "Hong Kong" },
        { .code= "HU", .name= "Hungary" },
        { .code= "IS", .name= "Iceland" },
        { .code= "IN", .name= "India" },
        { .code= "ID", .name= "Indonesia" },
        { .code= "IR", .name= "Iran, Islamic Republic Of" },
        { .code= "IQ", .name= "Iraq" },
        { .code= "IE", .name= "Ireland" },
        { .code= "IM", .name= "Isle Of Man" },
        { .code= "IL", .name= "Israel" },
        { .code= "IT", .name= "Italy" },
        { .code= "JM", .name= "Jamaica" },
        { .code= "JP", .name= "Japan" },
        { .code= "JE", .name= "Jersey" },
        { .code= "JO", .name= "Jordan" },
        { .code= "KZ", .name= "Kazakhstan" },
        { .code= "KE", .name= "Kenya" },
        { .code= "KI", .name= "Kiribati" },
        { .code= "KR", .name= "Korea" },
        { .code= "KW", .name= "Kuwait" },
        { .code= "KG", .name= "Kyrgyzstan" },
        { .code= "LA", .name= "Lao People\"s Democratic Republic" },
        { .code= "LV", .name= "Latvia" },
        { .code= "LB", .name= "Lebanon" },
        { .code= "LS", .name= "Lesotho" },
        { .code= "LR", .name= "Liberia" },
        { .code= "LY", .name= "Libyan Arab Jamahiriya" },
        { .code= "LI", .name= "Liechtenstein" },
        { .code= "LT", .name= "Lithuania" },
        { .code= "LU", .name= "Luxembourg" },
        { .code= "MO", .name= "Macao" },
        { .code= "MK", .name= "Macedonia" },
        { .code= "MG", .name= "Madagascar" },
        { .code= "MW", .name= "Malawi" },
        { .code= "MY", .name= "Malaysia" },
        { .code= "MV", .name= "Maldives" },
        { .code= "ML", .name= "Mali" },
        { .code= "MT", .name= "Malta" },
        { .code= "MH", .name= "Marshall Islands" },
        { .code= "MQ", .name= "Martinique" },
        { .code= "MR", .name= "Mauritania" },
        { .code= "MU", .name= "Mauritius" },
        { .code= "YT", .name= "Mayotte" },
        { .code= "MX", .name= "Mexico" },
        { .code= "FM", .name= "Micronesia, Federated States Of" },
        { .code= "MD", .name= "Moldova" },
        { .code= "MC", .name= "Monaco" },
        { .code= "MN", .name= "Mongolia" },
        { .code= "ME", .name= "Montenegro" },
        { .code= "MS", .name= "Montserrat" },
        { .code= "MA", .name= "Morocco" },
        { .code= "MZ", .name= "Mozambique" },
        { .code= "MM", .name= "Myanmar" },
        { .code= "NA", .name= "Namibia" },
        { .code= "NR", .name= "Nauru" },
        { .code= "NP", .name= "Nepal" },
        { .code= "NL", .name= "Netherlands" },
        { .code= "AN", .name= "Netherlands Antilles" },
        { .code= "NC", .name= "New Caledonia" },
        { .code= "NZ", .name= "New Zealand" },
        { .code= "NI", .name= "Nicaragua" },
        { .code= "NE", .name= "Niger" },
        { .code= "NG", .name= "Nigeria" },
        { .code= "NU", .name= "Niue" },
        { .code= "NF", .name= "Norfolk Island" },
        { .code= "MP", .name= "Northern Mariana Islands" },
        { .code= "NO", .name= "Norway" },
        { .code= "OM", .name= "Oman" },
        { .code= "PK", .name= "Pakistan" },
        { .code= "PW", .name= "Palau" },
        { .code= "PS", .name= "Palestinian Territory, Occupied" },
        { .code= "PA", .name= "Panama" },
        { .code= "PG", .name= "Papua New Guinea" },
        { .code= "PY", .name= "Paraguay" },
        { .code= "PE", .name= "Peru" },
        { .code= "PH", .name= "Philippines" },
        { .code= "PN", .name= "Pitcairn" },
        { .code= "PL", .name= "Poland" },
        { .code= "PT", .name= "Portugal" },
        { .code= "PR", .name= "Puerto Rico" },
        { .code= "QA", .name= "Qatar" },
        { .code= "RE", .name= "Reunion" },
        { .code= "RO", .name= "Romania" },
        { .code= "RU", .name= "Russian Federation" },
        { .code= "RW", .name= "Rwanda" },
        { .code= "BL", .name= "Saint Barthelemy" },
        { .code= "SH", .name= "Saint Helena" },
        { .code= "KN", .name= "Saint Kitts And Nevis" },
        { .code= "LC", .name= "Saint Lucia" },
        { .code= "MF", .name= "Saint Martin" },
        { .code= "PM", .name= "Saint Pierre And Miquelon" },
        { .code= "VC", .name= "Saint Vincent And Grenadines" },
        { .code= "WS", .name= "Samoa" },
        { .code= "SM", .name= "San Marino" },
        { .code= "ST", .name= "Sao Tome And Principe" },
        { .code= "SA", .name= "Saudi Arabia" },
        { .code= "SN", .name= "Senegal" },
        { .code= "RS", .name= "Serbia" },
        { .code= "SC", .name= "Seychelles" },
        { .code= "SL", .name= "Sierra Leone" },
        { .code= "SG", .name= "Singapore" },
        { .code= "SK", .name= "Slovakia" },
        { .code= "SI", .name= "Slovenia" },
        { .code= "SB", .name= "Solomon Islands" },
        { .code= "SO", .name= "Somalia" },
        { .code= "ZA", .name= "South Africa" },
        { .code= "GS", .name= "South Georgia And Sandwich Isl." },
        { .code= "ES", .name= "Spain" },
        { .code= "LK", .name= "Sri Lanka" },
        { .code= "SD", .name= "Sudan" },
        { .code= "SR", .name= "Suriname" },
        { .code= "SJ", .name= "Svalbard And Jan Mayen" },
        { .code= "SZ", .name= "Swaziland" },
        { .code= "SE", .name= "Sweden" },
        { .code= "CH", .name= "Switzerland" },
        { .code= "SY", .name= "Syrian Arab Republic" },
        { .code= "TW", .name= "Taiwan" },
        { .code= "TJ", .name= "Tajikistan" },
        { .code= "TZ", .name= "Tanzania" },
        { .code= "TH", .name= "Thailand" },
        { .code= "TL", .name= "Timor-Leste" },
        { .code= "TG", .name= "Togo" },
        { .code= "TK", .name= "Tokelau" },
        { .code= "TO", .name= "Tonga" },
        { .code= "TT", .name= "Trinidad And Tobago" },
        { .code= "TN", .name= "Tunisia" },
        { .code= "TR", .name= "Turkey" },
        { .code= "TM", .name= "Turkmenistan" },
        { .code= "TC", .name= "Turks And Caicos Islands" },
        { .code= "TV", .name= "Tuvalu" },
        { .code= "UG", .name= "Uganda" },
        { .code= "UA", .name= "Ukraine" },
        { .code= "AE", .name= "United Arab Emirates" },
        { .code= "GB", .name= "United Kingdom" },
        { .code= "US", .name= "United States" },
        { .code= "UM", .name= "United States Outlying Islands" },
        { .code= "UY", .name= "Uruguay" },
        { .code= "UZ", .name= "Uzbekistan" },
        { .code= "VU", .name= "Vanuatu" },
        { .code= "VE", .name= "Venezuela" },
        { .code= "VN", .name= "Viet Nam" },
        { .code= "VG", .name= "Virgin Islands, British" },
        { .code= "VI", .name= "Virgin Islands, U.S." },
        { .code= "WF", .name= "Wallis And Futuna" },
        { .code= "EH", .name= "Western Sahara" },
        { .code= "YE", .name= "Yemen" },
        { .code= "ZM", .name= "Zambia" },
        { .code= "ZW", .name= "Zimbabwe" }
    };

@charithar
Copy link

charithar commented May 25, 2022

Thanks. If somebody needs only the list of codes then,

$countryCodes = ['AF', 'AX', 'AL', 'DZ', 'AS', 'AD', 'AO', 'AI', 'AQ', 'AG', 'AR', 'AM', 'AW', 'AU', 'AT', 'AZ', 'BS', 'BH', 'BD', 'BB', 'BY', 'BE', 'BZ', 'BJ', 'BM', 'BT', 'BO', 'BA', 'BW', 'BV', 'BR', 'IO', 'BN', 'BG', 'BF', 'BI', 'KH', 'CM', 'CA', 'CV', 'KY', 'CF', 'TD', 'CL', 'CN', 'CX', 'CC', 'CO', 'KM', 'CG', 'CD', 'CK', 'CR', 'CI', 'HR', 'CU', 'CY', 'CZ', 'DK', 'DJ', 'DM', 'DO', 'EC', 'EG', 'SV', 'GQ', 'ER', 'EE', 'ET', 'FK', 'FO', 'FJ', 'FI', 'FR', 'GF', 'PF', 'TF', 'GA', 'GM', 'GE', 'DE', 'GH', 'GI', 'GR', 'GL', 'GD', 'GP', 'GU', 'GT', 'GG', 'GN', 'GW', 'GY', 'HT', 'HM', 'VA', 'HN', 'HK', 'HU', 'IS', 'IN', 'ID', 'IR', 'IQ', 'IE', 'IM', 'IL', 'IT', 'JM', 'JP', 'JE', 'JO', 'KZ', 'KE', 'KI', 'KR', 'KW', 'KG', 'LA', 'LV', 'LB', 'LS', 'LR', 'LY', 'LI', 'LT', 'LU', 'MO', 'MK', 'MG', 'MW', 'MY', 'MV', 'ML', 'MT', 'MH', 'MQ', 'MR', 'MU', 'YT', 'MX', 'FM', 'MD', 'MC', 'MN', 'ME', 'MS', 'MA', 'MZ', 'MM', 'NA', 'NR', 'NP', 'NL', 'AN', 'NC', 'NZ', 'NI', 'NE', 'NG', 'NU', 'NF', 'MP', 'NO', 'OM', 'PK', 'PW', 'PS', 'PA', 'PG', 'PY', 'PE', 'PH', 'PN', 'PL', 'PT', 'PR', 'QA', 'RE', 'RO', 'RU', 'RW', 'BL', 'SH', 'KN', 'LC', 'MF', 'PM', 'VC', 'WS', 'SM', 'ST', 'SA', 'SN', 'RS', 'SC', 'SL', 'SG', 'SK', 'SI', 'SB', 'SO', 'ZA', 'GS', 'ES', 'LK', 'SD', 'SR', 'SJ', 'SZ', 'SE', 'CH', 'SY', 'TW', 'TJ', 'TZ', 'TH', 'TL', 'TG', 'TK', 'TO', 'TT', 'TN', 'TR', 'TM', 'TC', 'TV', 'UG', 'UA', 'AE', 'GB', 'US', 'UM', 'UY', 'UZ', 'VU', 'VE', 'VN', 'VG', 'VI', 'WF', 'EH', 'YE', 'ZM', 'ZW'];

@Kasopej
Copy link

Kasopej commented May 10, 2023

YOU GUYS ARE THE BEST.. SO MUCH LOVE!!

@rehanshaikh1823
Copy link

'country_code_with_name' => [
    '+1' => 'United States',
    '+7' => 'Russia',
    '+20' => 'Egypt',
    '+27' => 'South Africa',
    '+30' => 'Greece',
    '+31' => 'Netherlands',
    '+32' => 'Belgium',
    '+33' => 'France',
    '+34' => 'Spain',
    '+36' => 'Hungary',
    '+39' => 'Italy',
    '+40' => 'Romania',
    '+41' => 'Switzerland',
    '+43' => 'Austria',
    '+44' => 'United Kingdom',
    '+45' => 'Denmark',
    '+46' => 'Sweden',
    '+48' => 'Poland',
    '+49' => 'Germany',
    '+51' => 'Peru',
    '+52' => 'Mexico',
    '+54' => 'Argentina',
    '+55' => 'Brazil',
    '+56' => 'Chile',
    '+57' => 'Colombia',
    '+58' => 'Venezuela',
    '+60' => 'Malaysia',
    '+61' => 'Australia',
    '+62' => 'Indonesia',
    '+63' => 'Philippines',
    '+64' => 'New Zealand',
    '+65' => 'Singapore',
    '+66' => 'Thailand',
    '+81' => 'Japan',
    '+82' => 'South Korea',
    '+84' => 'Vietnam',
    '+86' => 'China',
    '+90' => 'Turkey',
    '+91' => 'India',
    '+92' => 'Pakistan',
    '+93' => 'Afghanistan',
    '+94' => 'Sri Lanka',
    '+95' => 'Myanmar',
    '+98' => 'Iran',
    '+143' => 'Canada',
    '+212' => 'Morocco',
    '+216' => 'Tunisia',
    '+225' => 'Cote d\'Ivoire',
    '+234' => 'Nigeria',
    '+254' => 'Kenya',
    '+420' => 'Czech Republic',
    '+591' => 'Bolivia',
    '+673' => 'Brunei',
    '+678' => 'Vanuatu',
    '+679' => 'Fiji',
    '+682' => 'Cook Islands',
    '+683' => 'Niue',
    '+685' => 'Western Samoa',
    '+687' => 'American Samoa',
    '+688' => 'Nauru',
    '+689' => 'Kiribati',
    '+691' => 'Marshall Islands',
    '+692' => 'Micronesia (Federated States of)',
    '+694' => 'Palau',
    '+698' => 'Easter Island',
    '+850' => 'North Korea',
    '+852' => 'Hong Kong',
    '+853' => 'Macau',
    '+855' => 'Cambodia',
    '+886' => 'Taiwan',
    '+960' => 'Maldives',
    '+965' => 'Kuwait',
    '+966' => 'Saudi Arabia',
    '+967' => 'Yemen',
    '+968' => 'Oman',
    '+970' => 'Palestine',
    '+971' => 'United Arab Emirates',
    '+974' => 'Qatar',
    '+977' => 'Nepal',
    '+975' => 'Bhutan',
    '+976' => 'Mongolia',
    '+977' => 'Nepal',
    '+992' => 'Tajikistan',
    '+993' => 'Turkmenistan',
    '+994' => 'Azerbaijan',
    '+995' => 'Georgia',
    '+996' => 'Kyrgyzstan',
    '+998' => 'Uzbekistan',
],

@DanRozz
Copy link

DanRozz commented Dec 5, 2023

I strongly recommend that if you're doing an implementation that requires a country list, that you do not blindly use the entire list unless it's really needed as a requirements. Too many apps are developed with- "we need a country list? ok!" and then it goes live with a list of 80+ entries in a drop-down when the actual user use case is never going to need 'Vanuatu' or 'Mayotte'. Don't ship there? Don't have customers there? Never ever will anybody using the application actually pick that country? Then get rid of it.

(And, I guess.... Check for duplicates? The list from @rehanshaikh1823 has Nepal twice.)

@jellesiderius
Copy link

jellesiderius commented May 16, 2024

<?php

$countries = array(
    'AF' => ['name' => 'Afghanistan', 'alpha3' => 'AFG'],
    'AX' => ['name' => 'Aland Islands', 'alpha3' => 'ALA'],
    'AL' => ['name' => 'Albania', 'alpha3' => 'ALB'],
    'DZ' => ['name' => 'Algeria', 'alpha3' => 'DZA'],
    'AS' => ['name' => 'American Samoa', 'alpha3' => 'ASM'],
    'AD' => ['name' => 'Andorra', 'alpha3' => 'AND'],
    'AO' => ['name' => 'Angola', 'alpha3' => 'AGO'],
    'AI' => ['name' => 'Anguilla', 'alpha3' => 'AIA'],
    'AQ' => ['name' => 'Antarctica', 'alpha3' => 'ATA'],
    'AG' => ['name' => 'Antigua And Barbuda', 'alpha3' => 'ATG'],
    'AR' => ['name' => 'Argentina', 'alpha3' => 'ARG'],
    'AM' => ['name' => 'Armenia', 'alpha3' => 'ARM'],
    'AW' => ['name' => 'Aruba', 'alpha3' => 'ABW'],
    'AU' => ['name' => 'Australia', 'alpha3' => 'AUS'],
    'AT' => ['name' => 'Austria', 'alpha3' => 'AUT'],
    'AZ' => ['name' => 'Azerbaijan', 'alpha3' => 'AZE'],
    'BS' => ['name' => 'Bahamas', 'alpha3' => 'BHS'],
    'BH' => ['name' => 'Bahrain', 'alpha3' => 'BHR'],
    'BD' => ['name' => 'Bangladesh', 'alpha3' => 'BGD'],
    'BB' => ['name' => 'Barbados', 'alpha3' => 'BRB'],
    'BY' => ['name' => 'Belarus', 'alpha3' => 'BLR'],
    'BE' => ['name' => 'Belgium', 'alpha3' => 'BEL'],
    'BZ' => ['name' => 'Belize', 'alpha3' => 'BLZ'],
    'BJ' => ['name' => 'Benin', 'alpha3' => 'BEN'],
    'BM' => ['name' => 'Bermuda', 'alpha3' => 'BMU'],
    'BT' => ['name' => 'Bhutan', 'alpha3' => 'BTN'],
    'BO' => ['name' => 'Bolivia', 'alpha3' => 'BOL'],
    'BA' => ['name' => 'Bosnia And Herzegovina', 'alpha3' => 'BIH'],
    'BW' => ['name' => 'Botswana', 'alpha3' => 'BWA'],
    'BV' => ['name' => 'Bouvet Island', 'alpha3' => 'BVT'],
    'BR' => ['name' => 'Brazil', 'alpha3' => 'BRA'],
    'IO' => ['name' => 'British Indian Ocean Territory', 'alpha3' => 'IOT'],
    'BN' => ['name' => 'Brunei Darussalam', 'alpha3' => 'BRN'],
    'BG' => ['name' => 'Bulgaria', 'alpha3' => 'BGR'],
    'BF' => ['name' => 'Burkina Faso', 'alpha3' => 'BFA'],
    'BI' => ['name' => 'Burundi', 'alpha3' => 'BDI'],
    'KH' => ['name' => 'Cambodia', 'alpha3' => 'KHM'],
    'CM' => ['name' => 'Cameroon', 'alpha3' => 'CMR'],
    'CA' => ['name' => 'Canada', 'alpha3' => 'CAN'],
    'CV' => ['name' => 'Cape Verde', 'alpha3' => 'CPV'],
    'KY' => ['name' => 'Cayman Islands', 'alpha3' => 'CYM'],
    'CF' => ['name' => 'Central African Republic', 'alpha3' => 'CAF'],
    'TD' => ['name' => 'Chad', 'alpha3' => 'TCD'],
    'CL' => ['name' => 'Chile', 'alpha3' => 'CHL'],
    'CN' => ['name' => 'China', 'alpha3' => 'CHN'],
    'CX' => ['name' => 'Christmas Island', 'alpha3' => 'CXR'],
    'CC' => ['name' => 'Cocos (Keeling) Islands', 'alpha3' => 'CCK'],
    'CO' => ['name' => 'Colombia', 'alpha3' => 'COL'],
    'KM' => ['name' => 'Comoros', 'alpha3' => 'COM'],
    'CG' => ['name' => 'Congo', 'alpha3' => 'COG'],
    'CD' => ['name' => 'Congo, Democratic Republic', 'alpha3' => 'COD'],
    'CK' => ['name' => 'Cook Islands', 'alpha3' => 'COK'],
    'CR' => ['name' => 'Costa Rica', 'alpha3' => 'CRI'],
    'CI' => ['name' => 'Cote D\'Ivoire', 'alpha3' => 'CIV'],
    'HR' => ['name' => 'Croatia', 'alpha3' => 'HRV'],
    'CU' => ['name' => 'Cuba', 'alpha3' => 'CUB'],
    'CY' => ['name' => 'Cyprus', 'alpha3' => 'CYP'],
    'CZ' => ['name' => 'Czech Republic', 'alpha3' => 'CZE'],
    'DK' => ['name' => 'Denmark', 'alpha3' => 'DNK'],
    'DJ' => ['name' => 'Djibouti', 'alpha3' => 'DJI'],
    'DM' => ['name' => 'Dominica', 'alpha3' => 'DMA'],
    'DO' => ['name' => 'Dominican Republic', 'alpha3' => 'DOM'],
    'EC' => ['name' => 'Ecuador', 'alpha3' => 'ECU'],
    'EG' => ['name' => 'Egypt', 'alpha3' => 'EGY'],
    'SV' => ['name' => 'El Salvador', 'alpha3' => 'SLV'],
    'GQ' => ['name' => 'Equatorial Guinea', 'alpha3' => 'GNQ'],
    'ER' => ['name' => 'Eritrea', 'alpha3' => 'ERI'],
    'EE' => ['name' => 'Estonia', 'alpha3' => 'EST'],
    'ET' => ['name' => 'Ethiopia', 'alpha3' => 'ETH'],
    'FK' => ['name' => 'Falkland Islands (Malvinas)', 'alpha3' => 'FLK'],
    'FO' => ['name' => 'Faroe Islands', 'alpha3' => 'FRO'],
    'FJ' => ['name' => 'Fiji', 'alpha3' => 'FJI'],
    'FI' => ['name' => 'Finland', 'alpha3' => 'FIN'],
    'FR' => ['name' => 'France', 'alpha3' => 'FRA'],
    'GF' => ['name' => 'French Guiana', 'alpha3' => 'GUF'],
    'PF' => ['name' => 'French Polynesia', 'alpha3' => 'PYF'],
    'TF' => ['name' => 'French Southern Territories', 'alpha3' => 'ATF'],
    'GA' => ['name' => 'Gabon', 'alpha3' => 'GAB'],
    'GM' => ['name' => 'Gambia', 'alpha3' => 'GMB'],
    'GE' => ['name' => 'Georgia', 'alpha3' => 'GEO'],
    'DE' => ['name' => 'Germany', 'alpha3' => 'DEU'],
    'GH' => ['name' => 'Ghana', 'alpha3' => 'GHA'],
    'GI' => ['name' => 'Gibraltar', 'alpha3' => 'GIB'],
    'GR' => ['name' => 'Greece', 'alpha3' => 'GRC'],
    'GL' => ['name' => 'Greenland', 'alpha3' => 'GRL'],
    'GD' => ['name' => 'Grenada', 'alpha3' => 'GRD'],
    'GP' => ['name' => 'Guadeloupe', 'alpha3' => 'GLP'],
    'GU' => ['name' => 'Guam', 'alpha3' => 'GUM'],
    'GT' => ['name' => 'Guatemala', 'alpha3' => 'GTM'],
    'GG' => ['name' => 'Guernsey', 'alpha3' => 'GGY'],
    'GN' => ['name' => 'Guinea', 'alpha3' => 'GIN'],
    'GW' => ['name' => 'Guinea-Bissau', 'alpha3' => 'GNB'],
    'GY' => ['name' => 'Guyana', 'alpha3' => 'GUY'],
    'HT' => ['name' => 'Haiti', 'alpha3' => 'HTI'],
    'HM' => ['name' => 'Heard Island & Mcdonald Islands', 'alpha3' => 'HMD'],
    'VA' => ['name' => 'Holy See (Vatican City State)', 'alpha3' => 'VAT'],
    'HN' => ['name' => 'Honduras', 'alpha3' => 'HND'],
    'HK' => ['name' => 'Hong Kong', 'alpha3' => 'HKG'],
    'HU' => ['name' => 'Hungary', 'alpha3' => 'HUN'],
    'IS' => ['name' => 'Iceland', 'alpha3' => 'ISL'],
    'IN' => ['name' => 'India', 'alpha3' => 'IND'],
    'ID' => ['name' => 'Indonesia', 'alpha3' => 'IDN'],
    'IR' => ['name' => 'Iran, Islamic Republic Of', 'alpha3' => 'IRN'],
    'IQ' => ['name' => 'Iraq', 'alpha3' => 'IRQ'],
    'IE' => ['name' => 'Ireland', 'alpha3' => 'IRL'],
    'IM' => ['name' => 'Isle Of Man', 'alpha3' => 'IMN'],
    'IL' => ['name' => 'Israel', 'alpha3' => 'ISR'],
    'IT' => ['name' => 'Italy', 'alpha3' => 'ITA'],
    'JM' => ['name' => 'Jamaica', 'alpha3' => 'JAM'],
    'JP' => ['name' => 'Japan', 'alpha3' => 'JPN'],
    'JE' => ['name' => 'Jersey', 'alpha3' => 'JEY'],
    'JO' => ['name' => 'Jordan', 'alpha3' => 'JOR'],
    'KZ' => ['name' => 'Kazakhstan', 'alpha3' => 'KAZ'],
    'KE' => ['name' => 'Kenya', 'alpha3' => 'KEN'],
    'KI' => ['name' => 'Kiribati', 'alpha3' => 'KIR'],
    'KR' => ['name' => 'Korea', 'alpha3' => 'KOR'],
    'KW' => ['name' => 'Kuwait', 'alpha3' => 'KWT'],
    'KG' => ['name' => 'Kyrgyzstan', 'alpha3' => 'KGZ'],
    'LA' => ['name' => 'Lao People\'s Democratic Republic', 'alpha3' => 'LAO'],
    'LV' => ['name' => 'Latvia', 'alpha3' => 'LVA'],
    'LB' => ['name' => 'Lebanon', 'alpha3' => 'LBN'],
    'LS' => ['name' => 'Lesotho', 'alpha3' => 'LSO'],
    'LR' => ['name' => 'Liberia', 'alpha3' => 'LBR'],
    'LY' => ['name' => 'Libyan Arab Jamahiriya', 'alpha3' => 'LBY'],
    'LI' => ['name' => 'Liechtenstein', 'alpha3' => 'LIE'],
    'LT' => ['name' => 'Lithuania', 'alpha3' => 'LTU'],
    'LU' => ['name' => 'Luxembourg', 'alpha3' => 'LUX'],
    'MO' => ['name' => 'Macao', 'alpha3' => 'MAC'],
    'MK' => ['name' => 'Macedonia', 'alpha3' => 'MKD'],
    'MG' => ['name' => 'Madagascar', 'alpha3' => 'MDG'],
    'MW' => ['name' => 'Malawi', 'alpha3' => 'MWI'],
    'MY' => ['name' => 'Malaysia', 'alpha3' => 'MYS'],
    'MV' => ['name' => 'Maldives', 'alpha3' => 'MDV'],
    'ML' => ['name' => 'Mali', 'alpha3' => 'MLI'],
    'MT' => ['name' => 'Malta', 'alpha3' => 'MLT'],
    'MH' => ['name' => 'Marshall Islands', 'alpha3' => 'MHL'],
    'MQ' => ['name' => 'Martinique', 'alpha3' => 'MTQ'],
    'MR' => ['name' => 'Mauritania', 'alpha3' => 'MRT'],
    'MU' => ['name' => 'Mauritius', 'alpha3' => 'MUS'],
    'YT' => ['name' => 'Mayotte', 'alpha3' => 'MYT'],
    'MX' => ['name' => 'Mexico', 'alpha3' => 'MEX'],
    'FM' => ['name' => 'Micronesia, Federated States Of', 'alpha3' => 'FSM'],
    'MD' => ['name' => 'Moldova', 'alpha3' => 'MDA'],
    'MC' => ['name' => 'Monaco', 'alpha3' => 'MCO'],
    'MN' => ['name' => 'Mongolia', 'alpha3' => 'MNG'],
    'ME' => ['name' => 'Montenegro', 'alpha3' => 'MNE'],
    'MS' => ['name' => 'Montserrat', 'alpha3' => 'MSR'],
    'MA' => ['name' => 'Morocco', 'alpha3' => 'MAR'],
    'MZ' => ['name' => 'Mozambique', 'alpha3' => 'MOZ'],
    'MM' => ['name' => 'Myanmar', 'alpha3' => 'MMR'],
    'NA' => ['name' => 'Namibia', 'alpha3' => 'NAM'],
    'NR' => ['name' => 'Nauru', 'alpha3' => 'NRU'],
    'NP' => ['name' => 'Nepal', 'alpha3' => 'NPL'],
    'NL' => ['name' => 'Netherlands', 'alpha3' => 'NLD'],
    'AN' => ['name' => 'Netherlands Antilles', 'alpha3' => 'ANT'],
    'NC' => ['name' => 'New Caledonia', 'alpha3' => 'NCL'],
    'NZ' => ['name' => 'New Zealand', 'alpha3' => 'NZL'],
    'NI' => ['name' => 'Nicaragua', 'alpha3' => 'NIC'],
    'NE' => ['name' => 'Niger', 'alpha3' => 'NER'],
    'NG' => ['name' => 'Nigeria', 'alpha3' => 'NGA'],
    'NU' => ['name' => 'Niue', 'alpha3' => 'NIU'],
    'NF' => ['name' => 'Norfolk Island', 'alpha3' => 'NFK'],
    'MP' => ['name' => 'Northern Mariana Islands', 'alpha3' => 'MNP'],
    'NO' => ['name' => 'Norway', 'alpha3' => 'NOR'],
    'OM' => ['name' => 'Oman', 'alpha3' => 'OMN'],
    'PK' => ['name' => 'Pakistan', 'alpha3' => 'PAK'],
    'PW' => ['name' => 'Palau', 'alpha3' => 'PLW'],
    'PS' => ['name' => 'Palestinian Territory, Occupied', 'alpha3' => 'PSE'],
    'PA' => ['name' => 'Panama', 'alpha3' => 'PAN'],
    'PG' => ['name' => 'Papua New Guinea', 'alpha3' => 'PNG'],
    'PY' => ['name' => 'Paraguay', 'alpha3' => 'PRY'],
    'PE' => ['name' => 'Peru', 'alpha3' => 'PER'],
    'PH' => ['name' => 'Philippines', 'alpha3' => 'PHL'],
    'PN' => ['name' => 'Pitcairn', 'alpha3' => 'PCN'],
    'PL' => ['name' => 'Poland', 'alpha3' => 'POL'],
    'PT' => ['name' => 'Portugal', 'alpha3' => 'PRT'],
    'PR' => ['name' => 'Puerto Rico', 'alpha3' => 'PRI'],
    'QA' => ['name' => 'Qatar', 'alpha3' => 'QAT'],
    'RE' => ['name' => 'Reunion', 'alpha3' => 'REU'],
    'RO' => ['name' => 'Romania', 'alpha3' => 'ROU'],
    'RU' => ['name' => 'Russian Federation', 'alpha3' => 'RUS'],
    'RW' => ['name' => 'Rwanda', 'alpha3' => 'RWA'],
    'BL' => ['name' => 'Saint Barthelemy', 'alpha3' => 'BLM'],
    'SH' => ['name' => 'Saint Helena', 'alpha3' => 'SHN'],
    'KN' => ['name' => 'Saint Kitts And Nevis', 'alpha3' => 'KNA'],
    'LC' => ['name' => 'Saint Lucia', 'alpha3' => 'LCA'],
    'MF' => ['name' => 'Saint Martin', 'alpha3' => 'MAF'],
    'PM' => ['name' => 'Saint Pierre And Miquelon', 'alpha3' => 'SPM'],
    'VC' => ['name' => 'Saint Vincent And Grenadines', 'alpha3' => 'VCT'],
    'WS' => ['name' => 'Samoa', 'alpha3' => 'WSM'],
    'SM' => ['name' => 'San Marino', 'alpha3' => 'SMR'],
    'ST' => ['name' => 'Sao Tome And Principe', 'alpha3' => 'STP'],
    'SA' => ['name' => 'Saudi Arabia', 'alpha3' => 'SAU'],
    'SN' => ['name' => 'Senegal', 'alpha3' => 'SEN'],
    'RS' => ['name' => 'Serbia', 'alpha3' => 'SRB'],
    'SC' => ['name' => 'Seychelles', 'alpha3' => 'SYC'],
    'SL' => ['name' => 'Sierra Leone', 'alpha3' => 'SLE'],
    'SG' => ['name' => 'Singapore', 'alpha3' => 'SGP'],
    'SK' => ['name' => 'Slovakia', 'alpha3' => 'SVK'],
    'SI' => ['name' => 'Slovenia', 'alpha3' => 'SVN'],
    'SB' => ['name' => 'Solomon Islands', 'alpha3' => 'SLB'],
    'SO' => ['name' => 'Somalia', 'alpha3' => 'SOM'],
    'ZA' => ['name' => 'South Africa', 'alpha3' => 'ZAF'],
    'GS' => ['name' => 'South Georgia And Sandwich Isl.', 'alpha3' => 'SGS'],
    'ES' => ['name' => 'Spain', 'alpha3' => 'ESP'],
    'LK' => ['name' => 'Sri Lanka', 'alpha3' => 'LKA'],
    'SD' => ['name' => 'Sudan', 'alpha3' => 'SDN'],
    'SR' => ['name' => 'Suriname', 'alpha3' => 'SUR'],
    'SJ' => ['name' => 'Svalbard And Jan Mayen', 'alpha3' => 'SJM'],
    'SZ' => ['name' => 'Swaziland', 'alpha3' => 'SWZ'],
    'SE' => ['name' => 'Sweden', 'alpha3' => 'SWE'],
    'CH' => ['name' => 'Switzerland', 'alpha3' => 'CHE'],
    'SY' => ['name' => 'Syrian Arab Republic', 'alpha3' => 'SYR'],
    'TW' => ['name' => 'Taiwan', 'alpha3' => 'TWN'],
    'TJ' => ['name' => 'Tajikistan', 'alpha3' => 'TJK'],
    'TZ' => ['name' => 'Tanzania', 'alpha3' => 'TZA'],
    'TH' => ['name' => 'Thailand', 'alpha3' => 'THA'],
    'TL' => ['name' => 'Timor-Leste', 'alpha3' => 'TLS'],
    'TG' => ['name' => 'Togo', 'alpha3' => 'TGO'],
    'TK' => ['name' => 'Tokelau', 'alpha3' => 'TKL'],
    'TO' => ['name' => 'Tonga', 'alpha3' => 'TON'],
    'TT' => ['name' => 'Trinidad And Tobago', 'alpha3' => 'TTO'],
    'TN' => ['name' => 'Tunisia', 'alpha3' => 'TUN'],
    'TR' => ['name' => 'Turkey', 'alpha3' => 'TUR'],
    'TM' => ['name' => 'Turkmenistan', 'alpha3' => 'TKM'],
    'TC' => ['name' => 'Turks And Caicos Islands', 'alpha3' => 'TCA'],
    'TV' => ['name' => 'Tuvalu', 'alpha3' => 'TUV'],
    'UG' => ['name' => 'Uganda', 'alpha3' => 'UGA'],
    'UA' => ['name' => 'Ukraine', 'alpha3' => 'UKR'],
    'AE' => ['name' => 'United Arab Emirates', 'alpha3' => 'ARE'],
    'GB' => ['name' => 'United Kingdom', 'alpha3' => 'GBR'],
    'US' => ['name' => 'United States', 'alpha3' => 'USA'],
    'UM' => ['name' => 'United States Outlying Islands', 'alpha3' => 'UMI'],
    'UY' => ['name' => 'Uruguay', 'alpha3' => 'URY'],
    'UZ' => ['name' => 'Uzbekistan', 'alpha3' => 'UZB'],
    'VU' => ['name' => 'Vanuatu', 'alpha3' => 'VUT'],
    'VE' => ['name' => 'Venezuela', 'alpha3' => 'VEN'],
    'VN' => ['name' => 'Viet Nam', 'alpha3' => 'VNM'],
    'VG' => ['name' => 'Virgin Islands, British', 'alpha3' => 'VGB'],
    'VI' => ['name' => 'Virgin Islands, U.S.', 'alpha3' => 'VIR'],
    'WF' => ['name' => 'Wallis And Futuna', 'alpha3' => 'WLF'],
    'EH' => ['name' => 'Western Sahara', 'alpha3' => 'ESH'],
    'YE' => ['name' => 'Yemen', 'alpha3' => 'YEM'],
    'ZM' => ['name' => 'Zambia', 'alpha3' => 'ZMB'],
    'ZW' => ['name' => 'Zimbabwe', 'alpha3' => 'ZWE']
];

?>

@jonysthil
Copy link

country abrev and phone code in javascript

countryCodes = [
	{ 'AD': {'name': 'ANDORRA','code': '376'} },
	{ 'AE': {'name': 'UNITED ARAB EMIRATES','code': '971'} },
	{ 'AF': {'name': 'AFGHANISTAN','code': '93'} },
	{ 'AG': {'name': 'ANTIGUA AND BARBUDA','code': '1268'} },
	{ 'AI': {'name': 'ANGUILLA','code': '1264'} },
	{ 'AL': {'name': 'ALBANIA','code': '355'} },
	{ 'AM': {'name': 'ARMENIA','code': '374'} },
	{ 'AN': {'name': 'NETHERLANDS ANTILLES','code': '599'} },
	{ 'AO': {'name': 'ANGOLA','code': '244'} },
	{ 'AQ': {'name': 'ANTARCTICA','code': '672'} },
	{ 'AR': {'name': 'ARGENTINA','code': '54'} },
	{ 'AS': {'name': 'AMERICAN SAMOA','code': '1684'} },
	{ 'AT': {'name': 'AUSTRIA','code': '43'} },
	{ 'AU': {'name': 'AUSTRALIA','code': '61'} },
	{ 'AW': {'name': 'ARUBA','code': '297'} },
	{ 'AZ': {'name': 'AZERBAIJAN','code': '994'} },
	{ 'BA': {'name': 'BOSNIA AND HERZEGOVINA','code': '387'} },
	{ 'BB': {'name': 'BARBADOS','code': '1246'} },
	{ 'BD': {'name': 'BANGLADESH','code': '880'} },
	{ 'BE': {'name': 'BELGIUM','code': '32'} },
	{ 'BF': {'name': 'BURKINA FASO','code': '226'} },
	{ 'BG': {'name': 'BULGARIA','code': '359'} },
	{ 'BH': {'name': 'BAHRAIN','code': '973'} },
	{ 'BI': {'name': 'BURUNDI','code': '257'} },
	{ 'BJ': {'name': 'BENIN','code': '229'} },
	{ 'BL': {'name': 'SAINT BARTHELEMY','code': '590'} },
	{ 'BM': {'name': 'BERMUDA','code': '1441'} },
	{ 'BN': {'name': 'BRUNEI DARUSSALAM','code': '673'} },
	{ 'BO': {'name': 'BOLIVIA','code': '591'} },
	{ 'BR': {'name': 'BRAZIL','code': '55'} },
	{ 'BS': {'name': 'BAHAMAS','code': '1242'} },
	{ 'BT': {'name': 'BHUTAN','code': '975'} },
	{ 'BW': {'name': 'BOTSWANA','code': '267'} },
	{ 'BY': {'name': 'BELARUS','code': '375'} },
	{ 'BZ': {'name': 'BELIZE','code': '501'} },
	{ 'CA': {'name': 'CANADA','code': '1'} },
	{ 'CC': {'name': 'COCOS (KEELING) ISLANDS','code': '61'} },
	{ 'CD': {'name': 'CONGO, THE DEMOCRATIC REPUBLIC OF THE','code': '243'} },
	{ 'CF': {'name': 'CENTRAL AFRICAN REPUBLIC','code': '236'} },
	{ 'CG': {'name': 'CONGO','code': '242'} },
	{ 'CH': {'name': 'SWITZERLAND','code': '41'} },
	{ 'CI': {'name': 'COTE D IVOIRE','code': '225'} },
	{ 'CK': {'name': 'COOK ISLANDS','code': '682'} },
	{ 'CL': {'name': 'CHILE','code': '56'} },
	{ 'CM': {'name': 'CAMEROON','code': '237'} },
	{ 'CN': {'name': 'CHINA','code': '86'} },
	{ 'CO': {'name': 'COLOMBIA','code': '57'} },
	{ 'CR': {'name': 'COSTA RICA','code': '506'} },
	{ 'CU': {'name': 'CUBA','code': '53'} },
	{ 'CV': {'name': 'CAPE VERDE','code': '238'} },
	{ 'CX': {'name': 'CHRISTMAS ISLAND','code': '61'} },
	{ 'CY': {'name': 'CYPRUS','code': '357'} },
	{ 'CZ': {'name': 'CZECH REPUBLIC','code': '420'} },
	{ 'DE': {'name': 'GERMANY','code': '49'} },
	{ 'DJ': {'name': 'DJIBOUTI','code': '253'} },
	{ 'DK': {'name': 'DENMARK','code': '45'} },
	{ 'DM': {'name': 'DOMINICA','code': '1767'} },
	{ 'DO': {'name': 'DOMINICAN REPUBLIC','code': '1809'} },
	{ 'DZ': {'name': 'ALGERIA','code': '213'} },
	{ 'EC': {'name': 'ECUADOR','code': '593'} },
	{ 'EE': {'name': 'ESTONIA','code': '372'} },
	{ 'EG': {'name': 'EGYPT','code': '20'} },
	{ 'ER': {'name': 'ERITREA','code': '291'} },
	{ 'ES': {'name': 'SPAIN','code': '34'} },
	{ 'ET': {'name': 'ETHIOPIA','code': '251'} },
	{ 'FI': {'name': 'FINLAND','code': '358'} },
	{ 'FJ': {'name': 'FIJI','code': '679'} },
	{ 'FK': {'name': 'FALKLAND ISLANDS (MALVINAS)','code': '500'} },
	{ 'FM': {'name': 'MICRONESIA, FEDERATED STATES OF','code': '691'} },
	{ 'FO': {'name': 'FAROE ISLANDS','code': '298'} },
	{ 'FR': {'name': 'FRANCE','code': '33'} },
	{ 'GA': {'name': 'GABON','code': '241'} },
	{ 'GB': {'name': 'UNITED KINGDOM','code': '44'} },
	{ 'GD': {'name': 'GRENADA','code': '1473'} },
	{ 'GE': {'name': 'GEORGIA','code': '995'} },
	{ 'GH': {'name': 'GHANA','code': '233'} },
	{ 'GI': {'name': 'GIBRALTAR','code': '350'} },
	{ 'GL': {'name': 'GREENLAND','code': '299'} },
	{ 'GM': {'name': 'GAMBIA','code': '220'} },
	{ 'GN': {'name': 'GUINEA','code': '224'} },
	{ 'GQ': {'name': 'EQUATORIAL GUINEA','code': '240'} },
	{ 'GR': {'name': 'GREECE','code': '30'} },
	{ 'GT': {'name': 'GUATEMALA','code': '502'} },
	{ 'GU': {'name': 'GUAM','code': '1671'} },
	{ 'GW': {'name': 'GUINEA-BISSAU','code': '245'} },
	{ 'GY': {'name': 'GUYANA','code': '592'} },
	{ 'HK': {'name': 'HONG KONG','code': '852'} },
	{ 'HN': {'name': 'HONDURAS','code': '504'} },
	{ 'HR': {'name': 'CROATIA','code': '385'} },
	{ 'HT': {'name': 'HAITI','code': '509'} },
	{ 'HU': {'name': 'HUNGARY','code': '36'} },
	{ 'ID': {'name': 'INDONESIA','code': '62'} },
	{ 'IE': {'name': 'IRELAND','code': '353'} },
	{ 'IL': {'name': 'ISRAEL','code': '972'} },
	{ 'IM': {'name': 'ISLE OF MAN','code': '44'} },
	{ 'IN': {'name': 'INDIA','code': '91'} },
	{ 'IQ': {'name': 'IRAQ','code': '964'} },
	{ 'IR': {'name': 'IRAN, ISLAMIC REPUBLIC OF','code': '98'} },
	{ 'IS': {'name': 'ICELAND','code': '354'} },
	{ 'IT': {'name': 'ITALY','code': '39'} },
	{ 'JM': {'name': 'JAMAICA','code': '1876'} },
	{ 'JO': {'name': 'JORDAN','code': '962'} },
	{ 'JP': {'name': 'JAPAN','code': '81'} },
	{ 'KE': {'name': 'KENYA','code': '254'} },
	{ 'KG': {'name': 'KYRGYZSTAN','code': '996'} },
	{ 'KH': {'name': 'CAMBODIA','code': '855'} },
	{ 'KI': {'name': 'KIRIBATI','code': '686'} },
	{ 'KM': {'name': 'COMOROS','code': '269'} },
	{ 'KN': {'name': 'SAINT KITTS AND NEVIS','code': '1869'} },
	{ 'KP': {'name': 'KOREA DEMOCRATIC PEOPLES REPUBLIC OF','code': '850'} },
	{ 'KR': {'name': 'KOREA REPUBLIC OF','code': '82'} },
	{ 'KW': {'name': 'KUWAIT','code': '965'} },
	{ 'KY': {'name': 'CAYMAN ISLANDS','code': '1345'} },
	{ 'KZ': {'name': 'KAZAKSTAN','code': '7'} },
	{ 'LA': {'name': 'LAO PEOPLES DEMOCRATIC REPUBLIC','code': '856'} },
	{ 'LB': {'name': 'LEBANON','code': '961'} },
	{ 'LC': {'name': 'SAINT LUCIA','code': '1758'} },
	{ 'LI': {'name': 'LIECHTENSTEIN','code': '423'} },
	{ 'LK': {'name': 'SRI LANKA','code': '94'} },
	{ 'LR': {'name': 'LIBERIA','code': '231'} },
	{ 'LS': {'name': 'LESOTHO','code': '266'} },
	{ 'LT': {'name': 'LITHUANIA','code': '370'} },
	{ 'LU': {'name': 'LUXEMBOURG','code': '352'} },
	{ 'LV': {'name': 'LATVIA','code': '371'} },
	{ 'LY': {'name': 'LIBYAN ARAB JAMAHIRIYA','code': '218'} },
	{ 'MA': {'name': 'MOROCCO','code': '212'} },
	{ 'MC': {'name': 'MONACO','code': '377'} },
	{ 'MD': {'name': 'MOLDOVA, REPUBLIC OF','code': '373'} },
	{ 'ME': {'name': 'MONTENEGRO','code': '382'} },
	{ 'MF': {'name': 'SAINT MARTIN','code': '1599'} },
	{ 'MG': {'name': 'MADAGASCAR','code': '261'} },
	{ 'MH': {'name': 'MARSHALL ISLANDS','code': '692'} },
	{ 'MK': {'name': 'MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF','code': '389'} },
	{ 'ML': {'name': 'MALI','code': '223'} },
	{ 'MM': {'name': 'MYANMAR','code': '95'} },
	{ 'MN': {'name': 'MONGOLIA','code': '976'} },
	{ 'MO': {'name': 'MACAU','code': '853'} },
	{ 'MP': {'name': 'NORTHERN MARIANA ISLANDS','code': '1670'} },
	{ 'MR': {'name': 'MAURITANIA','code': '222'} },
	{ 'MS': {'name': 'MONTSERRAT','code': '1664'} },
	{ 'MT': {'name': 'MALTA','code': '356'} },
	{ 'MU': {'name': 'MAURITIUS','code': '230'} },
	{ 'MV': {'name': 'MALDIVES','code': '960'} },
	{ 'MW': {'name': 'MALAWI','code': '265'} },
	{ 'MX': {'name': 'MEXICO','code': '52'} },
	{ 'MY': {'name': 'MALAYSIA','code': '60'} },
	{ 'MZ': {'name': 'MOZAMBIQUE','code': '258'} },
	{ 'NA': {'name': 'NAMIBIA','code': '264'} },
	{ 'NC': {'name': 'NEW CALEDONIA','code': '687'} },
	{ 'NE': {'name': 'NIGER','code': '227'} },
	{ 'NG': {'name': 'NIGERIA','code': '234'} },
	{ 'NI': {'name': 'NICARAGUA','code': '505'} },
	{ 'NL': {'name': 'NETHERLANDS','code': '31'} },
	{ 'NO': {'name': 'NORWAY','code': '47'} },
	{ 'NP': {'name': 'NEPAL','code': '977'} },
	{ 'NR': {'name': 'NAURU','code': '674'} },
	{ 'NU': {'name': 'NIUE','code': '683'} },
	{ 'NZ': {'name': 'NEW ZEALAND','code': '64'} },
	{ 'OM': {'name': 'OMAN','code': '968'} },
	{ 'PA': {'name': 'PANAMA','code': '507'} },
	{ 'PE': {'name': 'PERU','code': '51'} },
	{ 'PF': {'name': 'FRENCH POLYNESIA','code': '689'} },
	{ 'PG': {'name': 'PAPUA NEW GUINEA','code': '675'} },
	{ 'PH': {'name': 'PHILIPPINES','code': '63'} },
	{ 'PK': {'name': 'PAKISTAN','code': '92'} },
	{ 'PL': {'name': 'POLAND','code': '48'} },
	{ 'PM': {'name': 'SAINT PIERRE AND MIQUELON','code': '508'} },
	{ 'PN': {'name': 'PITCAIRN','code': '870'} },
	{ 'PR': {'name': 'PUERTO RICO','code': '1'} },
	{ 'PT': {'name': 'PORTUGAL','code': '351'} },
	{ 'PW': {'name': 'PALAU','code': '680'} },
	{ 'PY': {'name': 'PARAGUAY','code': '595'} },
	{ 'QA': {'name': 'QATAR','code': '974'} },
	{ 'RO': {'name': 'ROMANIA','code': '40'} },
	{ 'RS': {'name': 'SERBIA','code': '381'} },
	{ 'RU': {'name': 'RUSSIAN FEDERATION','code': '7'} },
	{ 'RW': {'name': 'RWANDA','code': '250'} },
	{ 'SA': {'name': 'SAUDI ARABIA','code': '966'} },
	{ 'SB': {'name': 'SOLOMON ISLANDS','code': '677'} },
	{ 'SC': {'name': 'SEYCHELLES','code': '248'} },
	{ 'SD': {'name': 'SUDAN','code': '249'} },
	{ 'SE': {'name': 'SWEDEN','code': '46'} },
	{ 'SG': {'name': 'SINGAPORE','code': '65'} },
	{ 'SH': {'name': 'SAINT HELENA','code': '290'} },
	{ 'SI': {'name': 'SLOVENIA','code': '386'} },
	{ 'SK': {'name': 'SLOVAKIA','code': '421'} },
	{ 'SL': {'name': 'SIERRA LEONE','code': '232'} },
	{ 'SM': {'name': 'SAN MARINO','code': '378'} },
	{ 'SN': {'name': 'SENEGAL','code': '221'} },
	{ 'SO': {'name': 'SOMALIA','code': '252'} },
	{ 'SR': {'name': 'SURINAME','code': '597'} },
	{ 'ST': {'name': 'SAO TOME AND PRINCIPE','code': '239'} },
	{ 'SV': {'name': 'EL SALVADOR','code': '503'} },
	{ 'SY': {'name': 'SYRIAN ARAB REPUBLIC','code': '963'} },
	{ 'SZ': {'name': 'SWAZILAND','code': '268'} },
	{ 'TC': {'name': 'TURKS AND CAICOS ISLANDS','code': '1649'} },
	{ 'TD': {'name': 'CHAD','code': '235'} },
	{ 'TG': {'name': 'TOGO','code': '228'} },
	{ 'TH': {'name': 'THAILAND','code': '66'} },
	{ 'TJ': {'name': 'TAJIKISTAN','code': '992'} },
	{ 'TK': {'name': 'TOKELAU','code': '690'} },
	{ 'TL': {'name': 'TIMOR-LESTE','code': '670'} },
	{ 'TM': {'name': 'TURKMENISTAN','code': '993'} },
	{ 'TN': {'name': 'TUNISIA','code': '216'} },
	{ 'TO': {'name': 'TONGA','code': '676'} },
	{ 'TR': {'name': 'TURKEY','code': '90'} },
	{ 'TT': {'name': 'TRINIDAD AND TOBAGO','code': '1868'} },
	{ 'TV': {'name': 'TUVALU','code': '688'} },
	{ 'TW': {'name': 'TAIWAN, PROVINCE OF CHINA','code': '886'} },
	{ 'TZ': {'name': 'TANZANIA, UNITED REPUBLIC OF','code': '255'} },
	{ 'UA': {'name': 'UKRAINE','code': '380'} },
	{ 'UG': {'name': 'UGANDA','code': '256'} },
	{ 'US': {'name': 'UNITED STATES','code': '1'} },
	{ 'UY': {'name': 'URUGUAY','code': '598'} },
	{ 'UZ': {'name': 'UZBEKISTAN','code': '998'} },
	{ 'VA': {'name': 'HOLY SEE (VATICAN CITY STATE)','code': '39'} },
	{ 'VC': {'name': 'SAINT VINCENT AND THE GRENADINES','code': '1784'} },
	{ 'VE': {'name': 'VENEZUELA','code': '58'} },
	{ 'VG': {'name': 'VIRGIN ISLANDS, BRITISH','code': '1284'} },
	{ 'VI': {'name': 'VIRGIN ISLANDS, U.S.','code': '1340'} },
	{ 'VN': {'name': 'VIET NAM','code': '84'} },
	{ 'VU': {'name': 'VANUATU','code': '678'} },
	{ 'WF': {'name': 'WALLIS AND FUTUNA','code': '681'} },
	{ 'WS': {'name': 'SAMOA','code': '685'} },
	{ 'XK': {'name': 'KOSOVO','code': '381'} },
	{ 'YE': {'name': 'YEMEN','code': '967'} },
	{ 'YT': {'name': 'MAYOTTE','code': '262'} },
	{ 'ZA': {'name': 'SOUTH AFRICA','code': '27'} },
	{ 'ZM': {'name': 'ZAMBIA','code': '260'} },
	{ 'ZW': {'name': 'ZIMBABWE','code': '263'} }
];

Thank you, this is what I was looking for especially because of the phone codes.

@bernardlawes
Copy link

JSON, combination of continents and 2 letter country codes

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

@Enitoxy
Copy link

Enitoxy commented Oct 3, 2024

This gist is so funny, it's just lines upon lines of text in different formats

Very helpful too!

@McMazalf
Copy link

McMazalf commented Oct 3, 2024

Pretty useless now with the AI's around :(

@DanRozz
Copy link

DanRozz commented Oct 3, 2024

Just again yesterday I was on a site where they had a dropdown with country values that none of their customers will ever use. The issue isn't getting the list, it's that developers get crappy requirements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment