Skip to content

Instantly share code, notes, and snippets.

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