Skip to content

Instantly share code, notes, and snippets.

@DHS
Created November 4, 2011 18:51
Show Gist options
  • Save DHS/1340150 to your computer and use it in GitHub Desktop.
Save DHS/1340150 to your computer and use it in GitHub Desktop.
PHP array of all country names
<?php
$countries = array("Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegowina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", "Congo, the Democratic Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia (Hrvatska)", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Islands (Malvinas)", "Faroe Islands", "Fiji", "Finland", "France", "France Metropolitan", "French Guiana", "French Polynesia", "French Southern Territories", "Gabon", "Gambia", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Heard and Mc Donald Islands", "Holy See (Vatican City State)", "Honduras", "Hong Kong", "Hungary", "Iceland", "India", "Indonesia", "Iran (Islamic Republic of)", "Iraq", "Ireland", "Israel", "Italy", "Jamaica", "Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Korea, Democratic People's Republic of", "Korea, Republic of", "Kuwait", "Kyrgyzstan", "Lao, People's Democratic Republic", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libyan Arab Jamahiriya", "Liechtenstein", "Lithuania", "Luxembourg", "Macau", "Macedonia, The Former Yugoslav Republic of", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Martinique", "Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia, Federated States of", "Moldova, Republic of", "Monaco", "Mongolia", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru", "Nepal", "Netherlands", "Netherlands Antilles", "New Caledonia", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Niue", "Norfolk Island", "Northern Mariana Islands", "Norway", "Oman", "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Pitcairn", "Poland", "Portugal", "Puerto Rico", "Qatar", "Reunion", "Romania", "Russian Federation", "Rwanda", "Saint Kitts and Nevis", "Saint Lucia", "Saint Vincent and the Grenadines", "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Seychelles", "Sierra Leone", "Singapore", "Slovakia (Slovak Republic)", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "South Georgia and the South Sandwich Islands", "Spain", "Sri Lanka", "St. Helena", "St. Pierre and Miquelon", "Sudan", "Suriname", "Svalbard and Jan Mayen Islands", "Swaziland", "Sweden", "Switzerland", "Syrian Arab Republic", "Taiwan, Province of China", "Tajikistan", "Tanzania, United Republic of", "Thailand", "Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan", "Turks and Caicos Islands", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "United States", "United States Minor Outlying Islands", "Uruguay", "Uzbekistan", "Vanuatu", "Venezuela", "Vietnam", "Virgin Islands (British)", "Virgin Islands (U.S.)", "Wallis and Futuna Islands", "Western Sahara", "Yemen", "Yugoslavia", "Zambia", "Zimbabwe");
?>
@califat
Copy link

califat commented Nov 25, 2016

All theese ideas are awesome

@thegirlinthecafe
Copy link

Thank you all you lovely people! This saves so much time! :-)

@hassanskylinxtech
Copy link

Thanks so much

@theenoahmason
Copy link

theenoahmason commented Jul 27, 2017

For WordPress, with filter and translatable country names

<?php 
/**
 * Get Countries (WordPress)
 * 
 * Get translated Countries in WordPress. Runs output through a 
 * filter before returning to allow for customization through third
 * party plugins and themes, or for select removal/modification/addition 
 * of countries for whatever reason.
 * 
 * Function Usage: 
 * search and replace all instances of `example` and replace it with your 
 * theme or plugin's textdomain (example:twentyseventeen). Then call as:
 * $countries = example_get_countries();
 * 
 * Filter Usage:
 * function example_countries_filter( $countries ) {
 * 		// add a translatable country:
 * 		$countries['XX'] = __( 'Country Name', 'example' );
 * 		// remove a country:
 * 		unset( $countries['YY'] );
 *		// modify a country:
 *		$countries['US'] = __( 'America, F*ck Yeah.', 'example' );
 * 		// always return countries!
 * 		return $countries;
 * }
 * add_filter( 'example_countries_filters', 'example_countries_filter', 10 );
 * 
 * @link https://developer.wordpress.org/themes/functionality/internationalization/
 * @link https://developer.wordpress.org/plugins/internationalization/how-to-internationalize-your-plugin/
 * @link https://developer.wordpress.org/reference/functions/__/
 * @link https://developer.wordpress.org/plugins/hooks/filters/
 * @link https://developer.wordpress.org/reference/functions/apply_filters/
 * @link https://developer.wordpress.org/reference/functions/add_filter/
 * 
 * @return array Countries as Country code => Country name
 */
function example_get_countries() {

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

	/**
	 * Return the translated and filtered countries
	 */
	return $countries;
}

@tacic
Copy link

tacic commented Sep 13, 2017

Thank you. Pretty useful... That saves my day of checking an listing all the countries...

Copy link

ghost commented Sep 26, 2017

Thank you

@tattali
Copy link

tattali commented Oct 16, 2017

iso_alpha_2 and translation en-fr

$countryList = array(
    'AD' => array('en' => 'Andorra', 'fr' => 'Andorre'), 
    'AE' => array('en' => 'United Arab Emirates', 'fr' => 'Émirats arabes unis'), 
    'AF' => array('en' => 'Afghanistan', 'fr' => 'Afghanistan'), 
    'AG' => array('en' => 'Antigua and Barbuda', 'fr' => 'Antigua-et-Barbuda'), 
    'AI' => array('en' => 'Anguilla', 'fr' => 'Anguilla'), 
    'AL' => array('en' => 'Albania', 'fr' => 'Albanie'), 
    'AM' => array('en' => 'Armenia', 'fr' => 'Arménie'), 
    'AN' => array('en' => 'Netherlands Antilles', 'fr' => 'Antilles néerlandaises'), 
    'AO' => array('en' => 'Angola', 'fr' => 'Angola'), 
    'AQ' => array('en' => 'Antarctica', 'fr' => 'Antarctique'), 
    'AR' => array('en' => 'Argentina', 'fr' => 'Argentine'), 
    'AS' => array('en' => 'American Samoa', 'fr' => 'Samoa américaines'), 
    'AT' => array('en' => 'Austria', 'fr' => 'Autriche'), 
    'AU' => array('en' => 'Australia', 'fr' => 'Australie'), 
    'AW' => array('en' => 'Aruba', 'fr' => 'Aruba'), 
    'AX' => array('en' => 'Åland Islands', 'fr' => 'Îles Åland'), 
    'AZ' => array('en' => 'Azerbaijan', 'fr' => 'Azerbaïdjan'), 
    'BA' => array('en' => 'Bosnia and Herzegovina', 'fr' => 'Bosnie-Herzégovine'), 
    'BB' => array('en' => 'Barbados', 'fr' => 'Barbade'), 
    'BD' => array('en' => 'Bangladesh', 'fr' => 'Bangladesh'), 
    'BE' => array('en' => 'Belgium', 'fr' => 'Belgique'), 
    'BF' => array('en' => 'Burkina Faso', 'fr' => 'Burkina Faso'), 
    'BG' => array('en' => 'Bulgaria', 'fr' => 'Bulgarie'), 
    'BH' => array('en' => 'Bahrain', 'fr' => 'Bahreïn'), 
    'BI' => array('en' => 'Burundi', 'fr' => 'Burundi'), 
    'BJ' => array('en' => 'Benin', 'fr' => 'Bénin'), 
    'BL' => array('en' => 'Saint Barthélemy', 'fr' => 'Saint-Barthélémy'), 
    'BM' => array('en' => 'Bermuda', 'fr' => 'Bermudes'), 
    'BN' => array('en' => 'Brunei', 'fr' => 'Brunéi Darussalam'), 
    'BO' => array('en' => 'Bolivia', 'fr' => 'Bolivie'), 
    'BR' => array('en' => 'Brazil', 'fr' => 'Brésil'), 
    'BS' => array('en' => 'Bahamas', 'fr' => 'Bahamas'), 
    'BT' => array('en' => 'Bhutan', 'fr' => 'Bhoutan'), 
    'BV' => array('en' => 'Bouvet Island', 'fr' => 'Île Bouvet'), 
    'BW' => array('en' => 'Botswana', 'fr' => 'Botswana'), 
    'BY' => array('en' => 'Belarus', 'fr' => 'Bélarus'), 
    'BZ' => array('en' => 'Belize', 'fr' => 'Belize'), 
    'CA' => array('en' => 'Canada', 'fr' => 'Canada'), 
    'CC' => array('en' => 'Cocos [Keeling] Islands', 'fr' => 'Îles Cocos - Keeling'), 
    'CD' => array('en' => 'Congo - Kinshasa', 'fr' => 'République démocratique du Congo'), 
    'CF' => array('en' => 'Central African Republic', 'fr' => 'République centrafricaine'), 
    'CG' => array('en' => 'Congo - Brazzaville', 'fr' => 'Congo'), 
    'CH' => array('en' => 'Switzerland', 'fr' => 'Suisse'), 
    'CI' => array('en' => 'Côte d’Ivoire', 'fr' => 'Côte d’Ivoire'), 
    'CK' => array('en' => 'Cook Islands', 'fr' => 'Îles Cook'), 
    'CL' => array('en' => 'Chile', 'fr' => 'Chili'), 
    'CM' => array('en' => 'Cameroon', 'fr' => 'Cameroun'), 
    'CN' => array('en' => 'China', 'fr' => 'Chine'), 
    'CO' => array('en' => 'Colombia', 'fr' => 'Colombie'), 
    'CR' => array('en' => 'Costa Rica', 'fr' => 'Costa Rica'), 
    'CU' => array('en' => 'Cuba', 'fr' => 'Cuba'), 
    'CV' => array('en' => 'Cape Verde', 'fr' => 'Cap-Vert'), 
    'CX' => array('en' => 'Christmas Island', 'fr' => 'Île Christmas'), 
    'CY' => array('en' => 'Cyprus', 'fr' => 'Chypre'), 
    'CZ' => array('en' => 'Czech Republic', 'fr' => 'République tchèque'), 
    'DE' => array('en' => 'Germany', 'fr' => 'Allemagne'), 
    'DJ' => array('en' => 'Djibouti', 'fr' => 'Djibouti'), 
    'DK' => array('en' => 'Denmark', 'fr' => 'Danemark'), 
    'DM' => array('en' => 'Dominica', 'fr' => 'Dominique'), 
    'DO' => array('en' => 'Dominican Republic', 'fr' => 'République dominicaine'), 
    'DZ' => array('en' => 'Algeria', 'fr' => 'Algérie'), 
    'EC' => array('en' => 'Ecuador', 'fr' => 'Équateur'), 
    'EE' => array('en' => 'Estonia', 'fr' => 'Estonie'), 
    'EG' => array('en' => 'Egypt', 'fr' => 'Égypte'), 
    'EH' => array('en' => 'Western Sahara', 'fr' => 'Sahara occidental'), 
    'ER' => array('en' => 'Eritrea', 'fr' => 'Érythrée'), 
    'ES' => array('en' => 'Spain', 'fr' => 'Espagne'), 
    'ET' => array('en' => 'Ethiopia', 'fr' => 'Éthiopie'), 
    'FI' => array('en' => 'Finland', 'fr' => 'Finlande'), 
    'FJ' => array('en' => 'Fiji', 'fr' => 'Fidji'), 
    'FK' => array('en' => 'Falkland Islands', 'fr' => 'Îles Malouines'), 
    'FM' => array('en' => 'Micronesia', 'fr' => 'États fédérés de Micronésie'), 
    'FO' => array('en' => 'Faroe Islands', 'fr' => 'Îles Féroé'), 
    'FR' => array('en' => 'France', 'fr' => 'France'), 
    'GA' => array('en' => 'Gabon', 'fr' => 'Gabon'), 
    'GB' => array('en' => 'United Kingdom', 'fr' => 'Royaume-Uni'), 
    'GD' => array('en' => 'Grenada', 'fr' => 'Grenade'), 
    'GE' => array('en' => 'Georgia', 'fr' => 'Géorgie'), 
    'GF' => array('en' => 'French Guiana', 'fr' => 'Guyane française'), 
    'GG' => array('en' => 'Guernsey', 'fr' => 'Guernesey'), 
    'GH' => array('en' => 'Ghana', 'fr' => 'Ghana'), 
    'GI' => array('en' => 'Gibraltar', 'fr' => 'Gibraltar'), 
    'GL' => array('en' => 'Greenland', 'fr' => 'Groenland'), 
    'GM' => array('en' => 'Gambia', 'fr' => 'Gambie'), 
    'GN' => array('en' => 'Guinea', 'fr' => 'Guinée'), 
    'GP' => array('en' => 'Guadeloupe', 'fr' => 'Guadeloupe'), 
    'GQ' => array('en' => 'Equatorial Guinea', 'fr' => 'Guinée équatoriale'), 
    'GR' => array('en' => 'Greece', 'fr' => 'Grèce'), 
    'GS' => array('en' => 'South Georgia and the South Sandwich Islands', 'fr' => 'Géorgie du Sud et les îles Sandwich du Sud'), 
    'GT' => array('en' => 'Guatemala', 'fr' => 'Guatemala'), 
    'GU' => array('en' => 'Guam', 'fr' => 'Guam'), 
    'GW' => array('en' => 'Guinea-Bissau', 'fr' => 'Guinée-Bissau'), 
    'GY' => array('en' => 'Guyana', 'fr' => 'Guyana'), 
    'HK' => array('en' => 'Hong Kong SAR China', 'fr' => 'R.A.S. chinoise de Hong Kong'), 
    'HM' => array('en' => 'Heard Island and McDonald Islands', 'fr' => 'Îles Heard et MacDonald'), 
    'HN' => array('en' => 'Honduras', 'fr' => 'Honduras'), 
    'HR' => array('en' => 'Croatia', 'fr' => 'Croatie'), 
    'HT' => array('en' => 'Haiti', 'fr' => 'Haïti'), 
    'HU' => array('en' => 'Hungary', 'fr' => 'Hongrie'), 
    'ID' => array('en' => 'Indonesia', 'fr' => 'Indonésie'), 
    'IE' => array('en' => 'Ireland', 'fr' => 'Irlande'), 
    'IL' => array('en' => 'Israel', 'fr' => 'Israël'), 
    'IM' => array('en' => 'Isle of Man', 'fr' => 'Île de Man'), 
    'IN' => array('en' => 'India', 'fr' => 'Inde'), 
    'IO' => array('en' => 'British Indian Ocean Territory', 'fr' => 'Territoire britannique de l\'océan Indien'), 
    'IQ' => array('en' => 'Iraq', 'fr' => 'Irak'), 
    'IR' => array('en' => 'Iran', 'fr' => 'Iran'), 
    'IS' => array('en' => 'Iceland', 'fr' => 'Islande'), 
    'IT' => array('en' => 'Italy', 'fr' => 'Italie'), 
    'JE' => array('en' => 'Jersey', 'fr' => 'Jersey'), 
    'JM' => array('en' => 'Jamaica', 'fr' => 'Jamaïque'), 
    'JO' => array('en' => 'Jordan', 'fr' => 'Jordanie'), 
    'JP' => array('en' => 'Japan', 'fr' => 'Japon'), 
    'KE' => array('en' => 'Kenya', 'fr' => 'Kenya'), 
    'KG' => array('en' => 'Kyrgyzstan', 'fr' => 'Kirghizistan'), 
    'KH' => array('en' => 'Cambodia', 'fr' => 'Cambodge'), 
    'KI' => array('en' => 'Kiribati', 'fr' => 'Kiribati'), 
    'KM' => array('en' => 'Comoros', 'fr' => 'Comores'), 
    'KN' => array('en' => 'Saint Kitts and Nevis', 'fr' => 'Saint-Kitts-et-Nevis'), 
    'KP' => array('en' => 'North Korea', 'fr' => 'Corée du Nord'), 
    'KR' => array('en' => 'South Korea', 'fr' => 'Corée du Sud'), 
    'KW' => array('en' => 'Kuwait', 'fr' => 'Koweït'), 
    'KY' => array('en' => 'Cayman Islands', 'fr' => 'Îles Caïmans'), 
    'KZ' => array('en' => 'Kazakhstan', 'fr' => 'Kazakhstan'), 
    'LA' => array('en' => 'Laos', 'fr' => 'Laos'), 
    'LB' => array('en' => 'Lebanon', 'fr' => 'Liban'), 
    'LC' => array('en' => 'Saint Lucia', 'fr' => 'Sainte-Lucie'), 
    'LI' => array('en' => 'Liechtenstein', 'fr' => 'Liechtenstein'), 
    'LK' => array('en' => 'Sri Lanka', 'fr' => 'Sri Lanka'), 
    'LR' => array('en' => 'Liberia', 'fr' => 'Libéria'), 
    'LS' => array('en' => 'Lesotho', 'fr' => 'Lesotho'), 
    'LT' => array('en' => 'Lithuania', 'fr' => 'Lituanie'), 
    'LU' => array('en' => 'Luxembourg', 'fr' => 'Luxembourg'), 
    'LV' => array('en' => 'Latvia', 'fr' => 'Lettonie'), 
    'LY' => array('en' => 'Libya', 'fr' => 'Libye'), 
    'MA' => array('en' => 'Morocco', 'fr' => 'Maroc'), 
    'MC' => array('en' => 'Monaco', 'fr' => 'Monaco'), 
    'MD' => array('en' => 'Moldova', 'fr' => 'Moldavie'), 
    'ME' => array('en' => 'Montenegro', 'fr' => 'Monténégro'), 
    'MF' => array('en' => 'Saint Martin', 'fr' => 'Saint-Martin'), 
    'MG' => array('en' => 'Madagascar', 'fr' => 'Madagascar'), 
    'MH' => array('en' => 'Marshall Islands', 'fr' => 'Îles Marshall'), 
    'MK' => array('en' => 'Macedonia', 'fr' => 'Macédoine'), 
    'ML' => array('en' => 'Mali', 'fr' => 'Mali'), 
    'MM' => array('en' => 'Myanmar [Burma]', 'fr' => 'Myanmar'), 
    'MN' => array('en' => 'Mongolia', 'fr' => 'Mongolie'), 
    'MO' => array('en' => 'Macau SAR China', 'fr' => 'R.A.S. chinoise de Macao'), 
    'MP' => array('en' => 'Northern Mariana Islands', 'fr' => 'Îles Mariannes du Nord'), 
    'MQ' => array('en' => 'Martinique', 'fr' => 'Martinique'), 
    'MR' => array('en' => 'Mauritania', 'fr' => 'Mauritanie'), 
    'MS' => array('en' => 'Montserrat', 'fr' => 'Montserrat'), 
    'MT' => array('en' => 'Malta', 'fr' => 'Malte'), 
    'MU' => array('en' => 'Mauritius', 'fr' => 'Maurice'), 
    'MV' => array('en' => 'Maldives', 'fr' => 'Maldives'), 
    'MW' => array('en' => 'Malawi', 'fr' => 'Malawi'), 
    'MX' => array('en' => 'Mexico', 'fr' => 'Mexique'), 
    'MY' => array('en' => 'Malaysia', 'fr' => 'Malaisie'), 
    'MZ' => array('en' => 'Mozambique', 'fr' => 'Mozambique'), 
    'NA' => array('en' => 'Namibia', 'fr' => 'Namibie'), 
    'NC' => array('en' => 'New Caledonia', 'fr' => 'Nouvelle-Calédonie'), 
    'NE' => array('en' => 'Niger', 'fr' => 'Niger'), 
    'NF' => array('en' => 'Norfolk Island', 'fr' => 'Île Norfolk'), 
    'NG' => array('en' => 'Nigeria', 'fr' => 'Nigéria'), 
    'NI' => array('en' => 'Nicaragua', 'fr' => 'Nicaragua'), 
    'NL' => array('en' => 'Netherlands', 'fr' => 'Pays-Bas'), 
    'NO' => array('en' => 'Norway', 'fr' => 'Norvège'), 
    'NP' => array('en' => 'Nepal', 'fr' => 'Népal'), 
    'NR' => array('en' => 'Nauru', 'fr' => 'Nauru'), 
    'NU' => array('en' => 'Niue', 'fr' => 'Niue'), 
    'NZ' => array('en' => 'New Zealand', 'fr' => 'Nouvelle-Zélande'), 
    'OM' => array('en' => 'Oman', 'fr' => 'Oman'), 
    'PA' => array('en' => 'Panama', 'fr' => 'Panama'), 
    'PE' => array('en' => 'Peru', 'fr' => 'Pérou'), 
    'PF' => array('en' => 'French Polynesia', 'fr' => 'Polynésie française'), 
    'PG' => array('en' => 'Papua New Guinea', 'fr' => 'Papouasie-Nouvelle-Guinée'), 
    'PH' => array('en' => 'Philippines', 'fr' => 'Philippines'), 
    'PK' => array('en' => 'Pakistan', 'fr' => 'Pakistan'), 
    'PL' => array('en' => 'Poland', 'fr' => 'Pologne'), 
    'PM' => array('en' => 'Saint Pierre and Miquelon', 'fr' => 'Saint-Pierre-et-Miquelon'), 
    'PN' => array('en' => 'Pitcairn Islands', 'fr' => 'Pitcairn'), 
    'PR' => array('en' => 'Puerto Rico', 'fr' => 'Porto Rico'), 
    'PS' => array('en' => 'Palestinian Territories', 'fr' => 'Territoire palestinien'), 
    'PT' => array('en' => 'Portugal', 'fr' => 'Portugal'), 
    'PW' => array('en' => 'Palau', 'fr' => 'Palaos'), 
    'PY' => array('en' => 'Paraguay', 'fr' => 'Paraguay'), 
    'QA' => array('en' => 'Qatar', 'fr' => 'Qatar'), 
    'RE' => array('en' => 'Réunion', 'fr' => 'Réunion'), 
    'RO' => array('en' => 'Romania', 'fr' => 'Roumanie'), 
    'RS' => array('en' => 'Serbia', 'fr' => 'Serbie'), 
    'RU' => array('en' => 'Russia', 'fr' => 'Russie'), 
    'RW' => array('en' => 'Rwanda', 'fr' => 'Rwanda'), 
    'SA' => array('en' => 'Saudi Arabia', 'fr' => 'Arabie saoudite'), 
    'SB' => array('en' => 'Solomon Islands', 'fr' => 'Îles Salomon'), 
    'SC' => array('en' => 'Seychelles', 'fr' => 'Seychelles'), 
    'SD' => array('en' => 'Sudan', 'fr' => 'Soudan'), 
    'SE' => array('en' => 'Sweden', 'fr' => 'Suède'), 
    'SG' => array('en' => 'Singapore', 'fr' => 'Singapour'), 
    'SH' => array('en' => 'Saint Helena', 'fr' => 'Sainte-Hélène'), 
    'SI' => array('en' => 'Slovenia', 'fr' => 'Slovénie'), 
    'SJ' => array('en' => 'Svalbard and Jan Mayen', 'fr' => 'Svalbard et Île Jan Mayen'), 
    'SK' => array('en' => 'Slovakia', 'fr' => 'Slovaquie'), 
    'SL' => array('en' => 'Sierra Leone', 'fr' => 'Sierra Leone'), 
    'SM' => array('en' => 'San Marino', 'fr' => 'Saint-Marin'), 
    'SN' => array('en' => 'Senegal', 'fr' => 'Sénégal'), 
    'SO' => array('en' => 'Somalia', 'fr' => 'Somalie'), 
    'SR' => array('en' => 'Suriname', 'fr' => 'Suriname'), 
    'ST' => array('en' => 'São Tomé and Príncipe', 'fr' => 'Sao Tomé-et-Principe'), 
    'SV' => array('en' => 'El Salvador', 'fr' => 'El Salvador'), 
    'SY' => array('en' => 'Syria', 'fr' => 'Syrie'), 
    'SZ' => array('en' => 'Swaziland', 'fr' => 'Swaziland'), 
    'TC' => array('en' => 'Turks and Caicos Islands', 'fr' => 'Îles Turks et Caïques'), 
    'TD' => array('en' => 'Chad', 'fr' => 'Tchad'), 
    'TF' => array('en' => 'French Southern Territories', 'fr' => 'Terres australes françaises'), 
    'TG' => array('en' => 'Togo', 'fr' => 'Togo'), 
    'TH' => array('en' => 'Thailand', 'fr' => 'Thaïlande'), 
    'TJ' => array('en' => 'Tajikistan', 'fr' => 'Tadjikistan'), 
    'TK' => array('en' => 'Tokelau', 'fr' => 'Tokelau'), 
    'TL' => array('en' => 'Timor-Leste', 'fr' => 'Timor oriental'), 
    'TM' => array('en' => 'Turkmenistan', 'fr' => 'Turkménistan'), 
    'TN' => array('en' => 'Tunisia', 'fr' => 'Tunisie'), 
    'TO' => array('en' => 'Tonga', 'fr' => 'Tonga'), 
    'TR' => array('en' => 'Turkey', 'fr' => 'Turquie'), 
    'TT' => array('en' => 'Trinidad and Tobago', 'fr' => 'Trinité-et-Tobago'), 
    'TV' => array('en' => 'Tuvalu', 'fr' => 'Tuvalu'), 
    'TW' => array('en' => 'Taiwan', 'fr' => 'Taïwan'), 
    'TZ' => array('en' => 'Tanzania', 'fr' => 'Tanzanie'), 
    'UA' => array('en' => 'Ukraine', 'fr' => 'Ukraine'), 
    'UG' => array('en' => 'Uganda', 'fr' => 'Ouganda'), 
    'UM' => array('en' => 'U.S. Minor Outlying Islands', 'fr' => 'Îles Mineures Éloignées des États-Unis'), 
    'US' => array('en' => 'United States', 'fr' => 'États-Unis'), 
    'UY' => array('en' => 'Uruguay', 'fr' => 'Uruguay'), 
    'UZ' => array('en' => 'Uzbekistan', 'fr' => 'Ouzbékistan'), 
    'VA' => array('en' => 'Vatican City', 'fr' => 'État de la Cité du Vatican'), 
    'VC' => array('en' => 'Saint Vincent and the Grenadines', 'fr' => 'Saint-Vincent-et-les Grenadines'), 
    'VE' => array('en' => 'Venezuela', 'fr' => 'Venezuela'), 
    'VG' => array('en' => 'British Virgin Islands', 'fr' => 'Îles Vierges britanniques'), 
    'VI' => array('en' => 'U.S. Virgin Islands', 'fr' => 'Îles Vierges des États-Unis'), 
    'VN' => array('en' => 'Vietnam', 'fr' => 'Viêt Nam'), 
    'VU' => array('en' => 'Vanuatu', 'fr' => 'Vanuatu'), 
    'WF' => array('en' => 'Wallis and Futuna', 'fr' => 'Wallis-et-Futuna'), 
    'WS' => array('en' => 'Samoa', 'fr' => 'Samoa'), 
    'YE' => array('en' => 'Yemen', 'fr' => 'Yémen'), 
    'YT' => array('en' => 'Mayotte', 'fr' => 'Mayotte'), 
    'ZA' => array('en' => 'South Africa', 'fr' => 'Afrique du Sud'), 
    'ZM' => array('en' => 'Zambia', 'fr' => 'Zambie'), 
    'ZW' => array('en' => 'Zimbabwe', 'fr' => 'Zimbabwe')
);

@iresci23
Copy link

For those looking for a free REST service: https://restcountries.eu

@monkeymonk
Copy link

@milosb793
Copy link

Thanks everybody! <3

@slaFFik
Copy link

slaFFik commented Jan 30, 2018

Before using any of those arrays of countries above - check them manually. MOST OF THEM ARE INVALID!
They include regions, that are not countries. Example: Réunion - which is not a country.

Regions !== Countries.

@theenoahmason
Copy link

theenoahmason commented Feb 19, 2018

Thanks for the info @slaFFik, Fixed my example above. Any others you can see off hand?

@imchaitanyadesai
Copy link

Thank you for this.

@DDiimmkkaass
Copy link

thanks a lot

@quangpro1610
Copy link

Thanks you for your help :)

@bucktechnologies
Copy link

i want a country list with code , country name and continent
eg. $country_array = array( "US" => "United States"=>"North America")

@owldesign
Copy link

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

@maruffahmed
Copy link

Thank you bro

@nivla360
Copy link

Thanks

Copy link

ghost commented Sep 13, 2019

Javascript Peoples here for You

const countries = ["Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegovina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", "Congo, the Democratic Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia (Hrvatska)", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Islands (Malvinas)", "Faroe Islands", "Fiji", "Finland", "France", "France Metropolitan", "French Guiana", "French Polynesia", "French Southern Territories", "Gabon", "Gambia", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Heard and Mc Donald Islands", "Holy See (Vatican City State)", "Honduras", "Hong Kong", "Hungary", "Iceland", "India", "Indonesia", "Iran (Islamic Republic of)", "Iraq", "Ireland", "Israel", "Italy", "Jamaica", "Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Korea, Democratic People's Republic of", "Korea, Republic of", "Kuwait", "Kyrgyzstan", "Lao, People's Democratic Republic", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libyan Arab Jamahiriya", "Liechtenstein", "Lithuania", "Luxembourg", "Macau", "Macedonia, The Former Yugoslav Republic of", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Martinique", "Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia, Federated States of", "Moldova, Republic of", "Monaco", "Mongolia", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru", "Nepal", "Netherlands", "Netherlands Antilles", "New Caledonia", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Niue", "Norfolk Island", "Northern Mariana Islands", "Norway", "Oman", "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Pitcairn", "Poland", "Portugal", "Puerto Rico", "Qatar", "Reunion", "Romania", "Russian Federation", "Rwanda", "Saint Kitts and Nevis", "Saint Lucia", "Saint Vincent and the Grenadines", "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Seychelles", "Sierra Leone", "Singapore", "Slovakia (Slovak Republic)", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "South Georgia and the South Sandwich Islands", "Spain", "Sri Lanka", "St. Helena", "St. Pierre and Miquelon", "Sudan", "Suriname", "Svalbard and Jan Mayen Islands", "Swaziland", "Sweden", "Switzerland", "Syrian Arab Republic", "Taiwan, Province of China", "Tajikistan", "Tanzania, United Republic of", "Thailand", "Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan", "Turks and Caicos Islands", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "United States", "United States Minor Outlying Islands", "Uruguay", "Uzbekistan", "Vanuatu", "Venezuela", "Vietnam", "Virgin Islands (British)", "Virgin Islands (U.S.)", "Wallis and Futuna Islands", "Western Sahara", "Yemen", "Yugoslavia", "Zambia", "Zimbabwe"]

@foremtehan
Copy link

I love yall

@nirodaonline
Copy link

nirodaonline commented Dec 29, 2019

Hi guys

Based on https://gist.github.com/DHS/1340150#gistcomment-2323795 I wrote a script to generate a country list file for each language available on the REST API ("en", "de", "es", "fr", "ja", "it", "br", "pt", "nl", "hr", "fa"):

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://restcountries.eu/rest/v2/all');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl);
curl_close($curl);

$countries = json_decode($result);
$file_path = ABSPATH . '/wp-content/plugins/azimut-custom/inc/';
$langs = array("en", "de", "es", "fr", "ja", "it", "br", "pt", "nl", "hr", "fa");

foreach ($langs as $lang) {

    //prepare files
    file_put_contents($file_path . 'countries_'.$lang.'.php',
        "<?php\n\nreturn\n\tarray(\n", FILE_APPEND  );

    foreach ($countries as $country) {

        $country_code = $country->alpha2Code;
        $name = ($lang === 'en') ? $country->name : $country->translations->{$lang};
        file_put_contents($file_path . 'countries_'.$lang.'.php',
            "\t\t".'"'.$country_code.'" => "'.$name.'",'.PHP_EOL, FILE_APPEND  );

    }

    //Close array
    file_put_contents($file_path . 'countries_'.$lang.'.php',
        "\t);", FILE_APPEND  );

}

Hope it's useful!

@MrCrap
Copy link

MrCrap commented Jun 3, 2020

Thanks All..

@her0mx
Copy link

her0mx commented May 27, 2021

Thanks good man!

@git-e-001
Copy link

const countryAlpha2 = [
"AF",
"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",
"BQ",
"BA",
"BW",
"BV",
"BR",
"IO",
"BN",
"BG",
"BF",
"BI",
"CV",
"KH",
"CM",
"CA",
"KY",
"CF",
"TD",
"CL",
"CN",
"CX",
"CC",
"CO",
"KM",
"CD",
"CG",
"CK",
"CR",
"HR",
"CU",
"CW",
"CY",
"CZ",
"CI",
"DK",
"DJ",
"DM",
"DO",
"EC",
"EG",
"SV",
"GQ",
"ER",
"EE",
"SZ",
"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",
"KP",
"KR",
"KW",
"KG",
"LA",
"LV",
"LB",
"LS",
"LR",
"LY",
"LI",
"LT",
"LU",
"MO",
"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",
"NC",
"NZ",
"NI",
"NE",
"NG",
"NU",
"NF",
"MP",
"NO",
"OM",
"PK",
"PW",
"PS",
"PA",
"PG",
"PY",
"PE",
"PH",
"PN",
"PL",
"PT",
"PR",
"QA",
"MK",
"RO",
"RU",
"RW",
"RE",
"BL",
"SH",
"KN",
"LC",
"MF",
"PM",
"VC",
"WS",
"SM",
"ST",
"SA",
"SN",
"RS",
"SC",
"SL",
"SG",
"SX",
"SK",
"SI",
"SB",
"SO",
"ZA",
"GS",
"SS",
"ES",
"LK",
"SD",
"SR",
"SJ",
"SE",
"CH",
"SY",
"TW",
"TJ",
"TZ",
"TH",
"TL",
"TG",
"TK",
"TO",
"TT",
"TN",
"TR",
"TM",
"TC",
"TV",
"UG",
"UA",
"AE",
"GB",
"UM",
"US",
"UY",
"UZ",
"VU",
"VE",
"VN",
"VG",
"VI",
"WF",
"EH",
"YE",
"ZM",
"ZW",
"AX",
]

@dddkkk01
Copy link

this gist is awesome, saved a lot time for me , thank you all

@JonathanDSoto
Copy link

Thanks!

@Deele
Copy link

Deele commented May 19, 2023

Translations for Latvian locale:

return [
    'Papua New Guinea' => 'Papua Jaungvineja',
    'Cambodia' => 'Kambodža',
    'Kazakhstan' => 'Kazahstāna',
    'Neutral Zone' => 'Neitrālā zona',
    'Paraguay' => 'Paragvaja',
    'Åland Islands' => 'Olandes salas',
    'Syria' => 'Sīrija',
    'Bahamas' => 'Bahamas',
    'Côte d’Ivoire' => 'Kotdivuāra',
    'Solomon Islands' => 'Zālamana salas',
    'Montserrat' => 'Montserrata',
    'Mali' => 'Mali',
    'Marshall Islands' => 'Māršala salas',
    'Guadeloupe' => 'Gvadelupa',
    'Panama' => 'Panama',
    'Laos' => 'Laosa',
    'Argentina' => 'Argentīna',
    'Falkland Islands' => 'Folklenda salas',
    'Seychelles' => 'Seišelu salas',
    'Zambia' => 'Zambija',
    'Belize' =>     'Beliza',
    'Bahrain' => 'Bahreina',
    'Johnston Island' => 'Džonstona sala',
    'Guinea-Bissau' => 'Gvineja-Bisava',
    'Namibia' => 'Namībija',
    'Finland' => 'Somija',
    'Comoros' => 'Komoru salas',
    'Palestinian Territories' => 'Palestīna',
    'Faroe Islands' => 'Fēru salas',
    'Netherlands Antilles' => 'Nīderlandes Antiļas',
    'Georgia' => 'Gruzija',
    'Saint Kitts and Nevis' => 'Sentkitsa un Nevisa',
    'Yemen' => 'Jemena',
    'Eritrea' => 'Eritreja',
    'Puerto Rico' => 'Puertoriko',
    'Aruba' => 'Aruba',
    'Madagascar' => 'Madagaskara',
    'Libya' => 'Lībija',
    'Svalbard and Jan Mayen' => 'Svalbāra un Jana Majena salas',
    'South Georgia and the South Sandwich Islands' => 'Dienviddžordžija un Dienvidsendviču salas',
    'Sweden' => 'Zviedrija',
    'Saint Martin' => 'Senmartēna',
    'Malawi' => 'Malāvija',
    'Andorra' => 'Andora',
    'Liechtenstein' => 'Lihtenšteina',
    'Poland' => 'Polija',
    'Jordan' => 'Jordānija',
    'Bulgaria' => 'Bulgārija',
    'Tunisia' => 'Tunisija',
    'Union of Soviet Socialist Republics' => 'Padomju Savienība',
    'United Arab Emirates' => 'Apvienotie Arābu Emirāti',
    'Tuvalu' => 'Tuvalu',
    'Kenya' => 'Kenija',
    'French Polynesia' => 'Franču Polinēzija',
    'Brunei' => 'Bruneja',
    'Lebanon' => 'Libāna',
    'Djibouti' => 'Džibutija',
    'Azerbaijan' => 'Azerbaidžāna',
    'Cuba' => 'Kuba',
    'Czech Republic' => 'Čehija',
    'Saint Lucia' => 'Sentlūsija',
    'Mauritania' => 'Mauritānija',
    'Guernsey' => 'Gērnsija',
    'Mayotte' => 'Majota',
    'Israel' => 'Izraēla',
    'San Marino' => 'Sanmarīno',
    'Australia' => 'Austrālija',
    'Tajikistan' => 'Tadžikistāna',
    'Dronning Maud Land' => 'Droninga Maudas zeme',
    'Cameroon' => 'Kamerūna',
    'Gibraltar' => 'Gibraltārs',
    'Cyprus' => 'Kipra',
    'Northern Mariana Islands' => 'Ziemeļu Marianas salas',
    'Malaysia' => 'Malaizija',
    'Oman' => 'Omāna',
    'Iceland' => 'Islande',
    'Armenia' => 'Armēnija',
    'Gabon' => 'Gabona',
    'Metropolitan France' => 'Francijas metropolitānā daļa',
    'Luxembourg' => 'Luksemburga',
    'Hong Kong SAR China' => 'Honkongas Ķīnas īpašās pārvaldes apgabals',
    'Brazil' => 'Brazīlija',
    'Turks and Caicos Islands' => 'Tērksas un Kaikosas salas',
    'Algeria' => 'Alžīrija',
    'Pacific Islands Trust Territory' => 'Klusā okeāna salu uzticības teritorija',
    'Slovenia' => 'Slovēnija',
    'Jersey' => 'Džērsija',
    'Antigua and Barbuda' => 'Antigva un Barbuda',
    'Ecuador' => 'Ekvadora',
    'Colombia' => 'Kolumbija',
    'Moldova' => 'Moldova',
    'Cocos [Keeling] Islands' => 'Kokosu [Kīlinga] salas',
    'Vanuatu' => 'Vanuatu',
    'Italy' => 'Itālija',
    'Honduras' => 'Hondurasa',
    'Antarctica' => 'Antarktika',
    'Nauru' => 'Nauru',
    'Haiti' => 'Haiti',
    'Afghanistan' => 'Afganistāna',
    'Burundi' => 'Burundi',
    'Singapore' => 'Singapūra',
    'French Guiana' => 'Franču Gviāna',
    'American Samoa' => 'Amerikāņu Samoa',
    'Christmas Island' => 'Ziemsvētku sala',
    'East Germany' => 'Austrumvācija',
    'Vatican City' => 'Vatikāna pilsētvalsts',
    'Russia' => 'Krievija',
    'Macau SAR China' => 'Makao Ķīnas īpašās pārvaldes apgabals',
    'Netherlands' => 'Nīderlande',
    'China' => 'Ķīna',
    'British Antarctic Territory' => 'Britu Antarktikas teritorija',
    'Martinique' => 'Martinika',
    'Saint Pierre and Miquelon' => 'Senpjēra un Mikelona',
    'Kyrgyzstan' => 'Kirgīzija',
    'Bhutan' => 'Butāna',
    'Romania' => 'Rumānija',
    'Togo' => 'Togo',
    'Philippines' => 'Filipīnas',
    'Uzbekistan' => 'Uzbekistāna',
    'Myanmar [Burma]' => 'Mjanma [Birma]',
    'British Virgin Islands' => 'Britu Virdžīnu salas',
    'Zimbabwe' => 'Zimbabve',
    'Midway Islands' => 'Midveja salas',
    'Congo - Kinshasa' => 'Kongo - Kinšasa',
    'British Indian Ocean Territory' => 'Britu Indijas okeāna teritorija',
    'Montenegro' => 'Melnkalne',
    'Dominica' => 'Dominika',
    'Indonesia' => 'Indonēzija',
    'Benin' => 'Benina',
    'Angola' => 'Angola',
    'Sudan' => 'Sudāna',
    'Canton and Enderbury Islands' => 'Kantona un Enderberijas salas',
    'Congo - Brazzaville' => 'Kongo - Brazavila',
    'Portugal' => 'Portugāle',
    'New Caledonia' => 'Jaunkaledonija',
    'Grenada' => 'Grenāda',
    'North Korea' => 'Ziemeļkoreja',
    'Greece' => 'Grieķija',
    'Cayman Islands' => 'Kaimanu salas',
    'Mongolia' => 'Mongolija',
    'Latvia' => 'Latvija',
    'Iran' => 'Irāna',
    'Morocco' => 'Maroka',
    'Guyana' => 'Gajāna',
    'Guatemala' => 'Gvatemala',
    'U.S. Minor Outlying Islands' => 'ASV Mazās Aizjūras salas',
    'Iraq' => 'Irāka',
    'Chile' => 'Čīle',
    'Nepal' => 'Nepāla',
    'Heard Island and McDonald Islands' => 'Hērda sala un Makdonalda salas',
    'Isle of Man' => 'Mena sala',
    'Ukraine' => 'Ukraina',
    'Tanzania' => 'Tanzānija',
    'Ghana' => 'Gana',
    'Anguilla' => 'Angilja',
    'India' => 'Indija',
    'Canada' => 'Kanāda',
    'Maldives' => 'Maldīvija',
    'Turkey' => 'Turcija',
    'Belgium' => 'Beļģija',
    'Taiwan' => 'Taivāna',
    'Trinidad and Tobago' => 'Trinidāda un Tobāgo',
    'South Africa' => 'Dienvidāfrika',
    'Bermuda' => 'Bermudu salas',
    'Central African Republic' => 'Centrālāfrikas Republika',
    'Jamaica' => 'Jamaika',
    'Peru' => 'Peru',
    'Turkmenistan' => 'Turkmenistāna',
    'Germany' => 'Vācija',
    'Panama Canal Zone' => 'Panamas kanāla zona',
    'Tokelau' => 'Tokelau',
    'Fiji' => 'Fidži',
    'United States' => 'Amerikas Savienotās Valstis',
    'Guinea' => 'Gvineja',
    'Somalia' => 'Somālija',
    'Chad' => 'Čada',
    'Pitcairn Islands' => 'Pitkērna',
    'Thailand' => 'Taizeme',
    'Equatorial Guinea' => 'Ekvatoriālā Gvineja',
    'Kiribati' => 'Kiribati',
    'Costa Rica' => 'Kostarika',
    'Vietnam' => 'Vjetnama',
    'São Tomé and Príncipe' => 'Santome un Prinsipi',
    'Kuwait' => 'Kuveita',
    'Nigeria' => 'Nigērija',
    'Croatia' => 'Horvātija',
    'Uruguay' => 'Urugvaja',
    'Sri Lanka' => 'Šrilanka',
    'Cook Islands' => 'Kuka salas',
    'Timor-Leste' => 'Austrumtimora',
    'United Kingdom' => 'Apvienotā Karaliste',
    'Switzerland' => 'Šveice',
    'Samoa' => 'Samoa',
    'Spain' => 'Spānija',
    'Liberia' => 'Libērija',
    'Venezuela' => 'Venecuēla',
    'Burkina Faso' => 'Burkinafaso',
    'Swaziland' => 'Svazilenda',
    'Palau' => 'Palau',
    'Saint Barthélemy' => 'Senbartelmī',
    'Estonia' => 'Igaunija',
    'French Southern and Antarctic Territories' => 'Francijas Dienvidjūru un Antarktikas teritorijas',
    'Wallis and Futuna' => 'Volisa un Futuna',
    'Niue' => 'Niue',
    'Austria' => 'Austrija',
    'South Korea' => 'Dienvidkoreja',
    'North Vietnam' => 'Ziemeļvjetnama',
    'Mozambique' => 'Mozambika',
    'El Salvador' => 'Salvadora',
    'Monaco' => 'Monako',
    'Guam' => 'Guama',
    'Lesotho' => 'Lesoto',
    'Tonga' => 'Tonga',
    'Unknown or Invalid Region' => 'Nezināms vai nederīgs reģions',
    'Western Sahara' => 'Rietumsahāra',
    'Hungary' => 'Ungārija',
    'Japan' => 'Japāna',
    'Belarus' => 'Baltkrievija',
    'Mauritius' => 'Maurīcija',
    'Bouvet Island' => 'Buvē sala',
    'Norfolk Island' => 'Norfolkas sala',
    'Albania' => 'Albānija',
    'New Zealand' => 'Jaunzēlande',
    'People\'s Democratic Republic of Yemen' => 'Jemenas Tautas Demokrātiskā Republika',
    'Senegal' => 'Senegāla',
    'Macedonia' => 'Maķedonija',
    'U.S. Miscellaneous Pacific Islands' => 'ASV Klusā okeāna salas',
    'Ethiopia' => 'Etiopija',
    'Egypt' => 'Ēģipte',
    'Sierra Leone' => 'Sjerraleone',
    'Bolivia' => 'Bolīvija',
    'Wake Island' => 'Veika sala',
    'Malta' => 'Malta',
    'Saudi Arabia' => 'Saūda Arābija',
    'Cape Verde' => 'Kaboverde',
    'Pakistan' => 'Pakistāna',
    'Gambia' => 'Gambija',
    'Qatar' => 'Katara',
    'Ireland' => 'Īrija',
    'Serbia and Montenegro' => 'Serbija un Melnkalne',
    'U.S. Virgin Islands' => 'ASV Virdžīnas',
    'Slovakia' => 'Slovākija',
    'Lithuania' => 'Lietuva',
    'Serbia' => 'Serbija',
    'France' => 'Francija',
    'Bosnia and Herzegovina' => 'Bosnija un Hercegovina',
    'Niger' => 'Nigēra',
    'Rwanda' => 'Ruanda',
    'French Southern Territories' => 'Francijas Dienvidjūru teritorijas',
    'Bangladesh' => 'Bangladeša',
    'Nicaragua' => 'Nikaragva',
    'Barbados' => 'Barbadosa',
    'Norway' => 'Norvēģija',
    'Saint Vincent and the Grenadines' => 'Sentvinsenta un Grenadīnas',
    'Botswana' => 'Botsvāna',
    'Dominican Republic' => 'Dominikānas Republika',
    'Denmark' => 'Dānija',
    'Uganda' => 'Uganda',
    'Mexico' => 'Meksika',
    'Micronesia' => 'Mikronēzija',
    'Suriname' => 'Surinama',
    'Greenland' => 'Grenlande',
    'Saint Helena' => 'Sv.Helēna',
];

@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',
],

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