HOWTO: List of world countries in php array
$country_list = array(
"Afghanistan",
"Albania",
"Algeria",
"Andorra",
"Angola",
"Antigua and Barbuda",
"Argentina",
"Armenia",
"Australia",
"Austria",
"Azerbaijan",
"Bahamas",
"Bahrain",
"Bangladesh",
"Barbados",
"Belarus",
"Belgium",
"Belize",
"Benin",
"Bhutan",
"Bolivia",
"Bosnia and Herzegovina",
"Botswana",
"Brazil",
"Brunei",
"Bulgaria",
"Burkina Faso",
"Burundi",
"Cambodia",
"Cameroon",
"Canada",
"Cape Verde",
"Central African Republic",
"Chad",
"Chile",
"China",
"Colombi",
"Comoros",
"Congo (Brazzaville)",
"Congo",
"Costa Rica",
"Cote d'Ivoire",
"Croatia",
"Cuba",
"Cyprus",
"Czech Republic",
"Denmark",
"Djibouti",
"Dominica",
"Dominican Republic",
"East Timor (Timor Timur)",
"Ecuador",
"Egypt",
"El Salvador",
"Equatorial Guinea",
"Eritrea",
"Estonia",
"Ethiopia",
"Fiji",
"Finland",
"France",
"Gabon",
"Gambia, The",
"Georgia",
"Germany",
"Ghana",
"Greece",
"Grenada",
"Guatemala",
"Guinea",
"Guinea-Bissau",
"Guyana",
"Haiti",
"Honduras",
"Hungary",
"Iceland",
"India",
"Indonesia",
"Iran",
"Iraq",
"Ireland",
"Israel",
"Italy",
"Jamaica",
"Japan",
"Jordan",
"Kazakhstan",
"Kenya",
"Kiribati",
"Korea, North",
"Korea, South",
"Kuwait",
"Kyrgyzstan",
"Laos",
"Latvia",
"Lebanon",
"Lesotho",
"Liberia",
"Libya",
"Liechtenstein",
"Lithuania",
"Luxembourg",
"Macedonia",
"Madagascar",
"Malawi",
"Malaysia",
"Maldives",
"Mali",
"Malta",
"Marshall Islands",
"Mauritania",
"Mauritius",
"Mexico",
"Micronesia",
"Moldova",
"Monaco",
"Mongolia",
"Morocco",
"Mozambique",
"Myanmar",
"Namibia",
"Nauru",
"Nepa",
"Netherlands",
"New Zealand",
"Nicaragua",
"Niger",
"Nigeria",
"Norway",
"Oman",
"Pakistan",
"Palau",
"Panama",
"Papua New Guinea",
"Paraguay",
"Peru",
"Philippines",
"Poland",
"Portugal",
"Qatar",
"Romania",
"Russia",
"Rwanda",
"Saint Kitts and Nevis",
"Saint Lucia",
"Saint Vincent",
"Samoa",
"San Marino",
"Sao Tome and Principe",
"Saudi Arabia",
"Senegal",
"Serbia and Montenegro",
"Seychelles",
"Sierra Leone",
"Singapore",
"Slovakia",
"Slovenia",
"Solomon Islands",
"Somalia",
"South Africa",
"Spain",
"Sri Lanka",
"Sudan",
"Suriname",
"Swaziland",
"Sweden",
"Switzerland",
"Syria",
"Taiwan",
"Tajikistan",
"Tanzania",
"Thailand",
"Togo",
"Tonga",
"Trinidad and Tobago",
"Tunisia",
"Turkey",
"Turkmenistan",
"Tuvalu",
"Uganda",
"Ukraine",
"United Arab Emirates",
"United Kingdom",
"United States",
"Uruguay",
"Uzbekistan",
"Vanuatu",
"Vatican City",
"Venezuela",
"Vietnam",
"Yemen",
"Zambia",
"Zimbabwe"
);
Comments:
Aju Chacko (18-03-2008 13:47) :
Very very useful..i clicked three ads..but i know it doesn't value your help.John Smith (16-04-2008 16:02) :
Great,,, but why Palestine not exist in the list!!!Steven Marx (25-04-2008 20:55) :
Just what I needed, thanks. Would be even better without line breaks between countries, but that's a quibble.Mark Ormesher (25-05-2008 12:42) :
Nice one, very useful!erm... (06-06-2008 16:35) :
United kingdom is NOT a country... so you need scotland, england, wales, northern ireland & republic of ireland (thats isnt even in the UK!)alli (22-07-2008 15:56) :
thanks for this, saved me a fair bit of work =]thanks so mcuh! (14-09-2008 14:40) :
thanks!!!
the uk is a country, wiki it :)evilunix (02-10-2008 17:28) :
i just had to go through an entire list of countries by hand so it would remember the selection if the form didn't validate.. haha :/bagyo (05-11-2008 20:46) :
thanks so much... very usefuljothikumar (21-01-2009 14:31) :
It very usefull to me in easy to colect all countrybadadam (23-02-2009 15:15) :
very handy - thankssome dude (05-03-2009 11:37) :
Hong Kong and Macau are still countries.. they will become "China" from 2047.
Please modify your shit.emran (20-03-2009 11:56) :
Great help.thanks a lot.edesa (21-07-2009 20:00) :
very useful, I clicked ads too, :)renjith (27-08-2009 10:03) :
its verry help full fr mee.... if it is in the key=>value form its more helpfull...ALoses (18-09-2009 16:53) :
Here you go!
$country_list = array(
'1'=>"Afghanistan",
'2'=>"Albania",
'3'=>"Algeria",
'4'=>"Andorra",
'5'=>"Angola",
'6'=>"Antigua and Barbuda",
'7'=>"Argentina",
'8'=>"Armenia",
'9'=>"Australia",
'10'=>"Austria",
'11'=>"Azerbaijan",
'12'=>"Bahamas",
'13'=>"Bahrain",
'14'=>"Bangladesh",
'15'=>"Barbados",
'16'=>"Belarus",
'17'=>"Belgium",
'18'=>"Belize",
'19'=>"Benin",
'20'=>"Bhutan",
'21'=>"Bolivia",
'22'=>"Bosnia and Herzegovina",
'23'=>"Botswana",
'24'=>"Brazil",
'25'=>"Brunei",
'26'=>"Bulgaria",
'27'=>"Burkina Faso",
'28'=>"Burundi",
'29'=>"Cambodia",
'30'=>"Cameroon",
'31'=>"Canada",
'32'=>"Cape Verde",
'33'=>"Central African Republic",
'34'=>"Chad",
'35'=>"Chile",
'36'=>"China",
'37'=>"Colombi",
'38'=>"Comoros",
'39'=>"Congo (Brazzaville)",
'40'=>"Congo",
'41'=>"Costa Rica",
'42'=>"Cote d'Ivoire",
'43'=>"Croatia",
'44'=>"Cuba",
'45'=>"Cyprus",
'46'=>"Czech Republic",
'47'=>"Denmark",
'48'=>"Djibouti",
'49'=>"Dominica",
'50'=>"Dominican Republic",
'51'=>"East Timor (Timor Timur)",
'52'=>"Ecuador",
'53'=>"Egypt",
'54'=>"El Salvador",
'55'=>"Equatorial Guinea",
'56'=>"Eritrea",
'57'=>"Estonia",
'58'=>"Ethiopia",
'59'=>"Fiji",
'60'=>"Finland",
'61'=>"France",
'62'=>"Gabon",
'63'=>"Gambia, The",
'64'=>"Georgia",
'65'=>"Germany",
'66'=>"Ghana",
'67'=>"Greece",
'68'=>"Grenada",
'69'=>"Guatemala",
'70'=>"Guinea",
'71'=>"Guinea-Bissau",
'72'=>"Guyana",
'73'=>"Haiti",
'74'=>"Honduras",
'75'=>"Hungary",
'76'=>"Iceland",
'77'=>"India",
'78'=>"Indonesia",
'79'=>"Iran",
'80'=>"Iraq",
'81'=>"Ireland",
'82'=>"Israel",
'83'=>"Italy",
'84'=>"Jamaica",
'85'=>"Japan",
'86'=>"Jordan",
'87'=>"Kazakhstan",
'88'=>"Kenya",
'89'=>"Kiribati",
'90'=>"Korea, North",
'91'=>"Korea, South",
'92'=>"Kuwait",
'93'=>"Kyrgyzstan",
'94'=>"Laos",
'95'=>"Latvia",
'96'=>"Lebanon",
'97'=>"Lesotho",
'98'=>"Liberia",
'99'=>"Libya",
'100'=>"Liechtenstein",
'101'=>"Lithuania",
'102'=>"Luxembourg",
'103'=>"Macedonia",
'104'=>"Madagascar",
'105'=>"Malawi",
'106'=>"Malaysia",
'107'=>"Maldives",
'108'=>"Mali",
'109'=>"Malta",
'110'=>"Marshall Islands",
'111'=>"Mauritania",
'112'=>"Mauritius",
'113'=>"Mexico",
'114'=>"Micronesia",
'115'=>"Moldova",
'116'=>"Monaco",
'117'=>"Mongolia",
'118'=>"Morocco",
'119'=>"Mozambique",
'120'=>"Myanmar",
'121'=>"Namibia",
'122'=>"Nauru",
'123'=>"Nepa",
'124'=>"Netherlands",
'125'=>"New Zealand",
'126'=>"Nicaragua",
'127'=>"Niger",
'128'=>"Nigeria",
'129'=>"Norway",
'130'=>"Oman",
'131'=>"Pakistan",
'132'=>"Palau",
'133'=>"Panama",
'134'=>"Papua New Guinea",
'135'=>"Paraguay",
'136'=>"Peru",
'137'=>"Philippines",
'138'=>"Poland",
'139'=>"Portugal",
'140'=>"Qatar",
'141'=>"Romania",
'142'=>"Russia",
'143'=>"Rwanda",
'144'=>"Saint Kitts and Nevis",
'145'=>"Saint Lucia",
'146'=>"Saint Vincent",
'147'=>"Samoa",
'148'=>"San Marino",
'149'=>"Sao Tome and Principe",
'150'=>"Saudi Arabia",
'151'=>"Senegal",
'152'=>"Serbia and Montenegro",
'153'=>"Seychelles",
'154'=>"Sierra Leone",
'155'=>"Singapore",
'156'=>"Slovakia",
'157'=>"Slovenia",
'158'=>"Solomon Islands",
'159'=>"Somalia",
'160'=>"South Africa",
'161'=>"Spain",
'162'=>"Sri Lanka",
'163'=>"Sudan",
'164'=>"Suriname",
'165'=>"Swaziland",
'166'=>"Sweden",
'167'=>"Switzerland",
'168'=>"Syria",
'169'=>"Taiwan",
'170'=>"Tajikistan",
'171'=>"Tanzania",
'172'=>"Thailand",
'173'=>"Togo",
'174'=>"Tonga",
'175'=>"Trinidad and Tobago",
'176'=>"Tunisia",
'177'=>"Turkey",
'178'=>"Turkmenistan",
'179'=>"Tuvalu",
'180'=>"Uganda",
'181'=>"Ukraine",
'182'=>"United Arab Emirates",
'183'=>"United Kingdom",
'184'=>"United States",
'185'=>"Uruguay",
'186'=>"Uzbekistan",
'187'=>"Vanuatu",
'188'=>"Vatican City",
'189'=>"Venezuela",
'190'=>"Vietnam",
'191'=>"Yemen",
'192'=>"Zambia",
'193'=>"Zimbabwe"
);
bala.nita09 (14-11-2009 14:51) :
Just what I wanted. Special Thanks goes to 'ALoses' since his/her version is the one i copied. But ALoses' version can be generated on our own by just using foreach loop. Thanks all folks!Nowaker (21-11-2009 19:51) :
Under which license do you publish this code? I know that everyone can create the same array but I copy this one I need a license.Nowaker (21-11-2009 19:55) :
Under what license do you publish this list?i guess im right (07-12-2009 06:40) :
Surely its a free :DPavel (21-12-2009 14:06) :
Guys, here is the list of countries with dialing codes!
'Afghanistan' => '93',
'Albania' => '355',
'Algeria' => '213',
'American Samoa' => '1 684',
'Andorra' => '376',
'Angola' => '244',
'Anguilla' => '1264',
'Antarctica' => '672',
'Antigua and Barbuda' => '1268',
'Antilles, Netherlands' => '599',
'Argentina' => '54',
'Armenia' => '374',
'Aruba' => '297',
'Australia' => '61',
'Austria' => '43',
'Azerbaijan' => '994',
'Bahamas' => '1242',
'Bahrain' => '973',
'Bangladesh' => '880',
'Barbados' => '1246',
'Belarus' => '375',
'Belgium' => '375',
'Belize' => '501',
'Benin' => '229',
'Bermuda' => '1 441',
'Bhutan' => '975',
'Bolivia' => '591',
'Bosnia and Herzegovina' => '387',
'Botswana' => '267',
'Brazil' => '55',
'British Indian Ocean Territory' => '246',
'British Virgin Islands' => '1 284',
'Brunei Darussalam' => '673',
'Bulgaria' => '359',
'Burkina Faso' => '226',
'Burundi' => '257',
'Cambodia' => '855',
'Cameroon' => '237',
'Canada' => '1',
'Cape Verde' => '238',
'Cayman Islands' => '1 345',
'Central African Republic' => '236',
'Chad' => '235',
'Chile' => '56',
'China' => '86',
'Christmas Island' => '64',
'Cocos (Keeling) Islands' => '61',
'Colombia' => '57',
'Comoros' => '269',
'Congo' => '242',
'Cook Islands' => '682',
'Costa Rica' => '506',
'Cote D\'Ivoire' => '225',
'Croatia' => '385',
'Cuba' => '53',
'Cyprus' => '357',
'Czech Republic' => '420',
'Denmark' => '45',
'Djibouti' => '253',
'Dominica' => '1 767',
'Dominican Republic' => '1 809',
'East Timor (Timor-Leste)' => '670',
'Ecuador' => '593',
'Egypt' => '20',
'El Salvador' => '503',
'Equatorial Guinea' => '240',
'Eritrea' => '291',
'Estonia' => '372',
'Ethiopia' => '251',
'Falkland Islands (Malvinas)' => '500',
'Faroe Islands' => '298',
'Fiji' => '679',
'Finland' => '358',
'France' => '33',
'French Guiana' => '594',
'French Polynesia' => '689',
'Gabon' => '241',
'Gambia, the' => '220',
'Georgia' => '995',
'Germany' => '49',
'Ghana' => '233',
'Gibraltar' => '350',
'Greece' => '30',
'Greenland' => '299',
'Grenada' => '1 473',
'Guadeloupe' => '590',
'Guam' => '1 671',
'Guatemala' => '502',
'Guernsey and Alderney' => '5399',
'Guinea' => '224',
'Guinea-Bissau' => '245',
'Guinea, Equatorial' => '240',
'Guiana, French' => '594',
'Guyana' => '592',
'Haiti' => '509',
'Holy See (Vatican City State)' => '379',
'Holland' => '31',
'Honduras' => '504',
'Hong Kong, (China)' => '852',
'Hungary' => '36',
'Iceland' => '354',
'India' => '91',
'Indonesia' => '62',
'Iran' => '98',
'Iraq' => '964',
'Ireland' => '353',
'Isle of Man' => '44',
'Israel' => '972',
'Italy' => '39',
'Jamaica' => '1 876',
'Japan' => '81',
'Jersey' => '44',
'Jordan' => '962',
'Kazakhstan' => '7',
'Kenya' => '254',
'Kiribati' => '686',
'Korea(North)' => '850',
'Korea(South)' => '82',
'Kosovo' => '381',
'Kuwait' => '965',
'Kyrgyzstan' => '996',
'Lao People\'s Democratic Republic' => '856',
'Latvia' => '371',
'Lebanon' => '961',
'Lesotho' => '266',
'Liberia' => '231',
'Libyan Arab Jamahiriya' => '218',
'Liechtenstein' => '423',
'Lithuania' => '370',
'Luxembourg' => '352',
'Macao, (China)' => '853',
'Macedonia, TFYR' => '389',
'Madagascar' => '261',
'Malawi' => '265',
'Malaysia' => '60',
'Maldives' => '960',
'Mali' => '223',
'Malta' => '356',
'Marshall Islands' => '692',
'Martinique' => '596',
'Mauritania' => '222',
'Mauritius' => '230',
'Mayotte' => '262',
'Mexico' => '52',
'Micronesia' => '691',
'Moldova' => '373',
'Monaco' => '377',
'Mongolia' => '976',
'Montenegro' => '382',
'Montserrat' => '1 664',
'Morocco' => '212',
'Mozambique' => '258',
'Myanmar' => '95',
'Namibia' => '264',
'Nauru' => '674',
'Nepal' => '977',
'Netherlands' => '31',
'Netherlands Antilles' => '599',
'New Caledonia' => '687',
'New Zealand' => '64',
'Nicaragua' => '505',
'Niger' => '227',
'Nigeria' => '234',
'Niue' => '683',
'Norfolk Island' => '672',
'Northern Mariana Islands' => '1 670',
'Norway' => '47',
'Oman' => '968',
'Pakistan' => '92',
'Palau' => '680',
'Palestinian Territory' => '970',
'Panama' => '507',
'Papua New Guinea' => '675',
'Paraguay' => '595',
'Peru' => '51',
'Philippines' => '63',
'Pitcairn Island' => '872',
'Poland' => '48',
'Portugal' => '351',
'Puerto Rico' => '1787',
'Qatar' => '974',
'Reunion' => '262',
'Romania' => '40',
'Russia' => '7',
'Rwanda' => '250',
'Sahara' => '212',
'Saint Helena' => '290',
'Saint Kitts and Nevis' => '1869',
'Saint Lucia' => '1758',
'Saint Pierre and Miquelon' => '508',
'Saint Vincent and the Grenadines' => '1784',
'Samoa' => '685',
'San Marino' => '374',
'Sao Tome and Principe' => '239',
'Saudi Arabia' => '966',
'Senegal' => '221',
'Serbia' => '381',
'Seychelles' => '248',
'Sierra Leone' => '232',
'Singapore' => '65',
'Slovakia' => '421',
'Slovenia' => '386',
'Solomon Islands' => '677',
'Somalia' => '252',
'South Africa' => '27',
'S. Georgia and S. Sandwich Is.' => '500',
'Spain' => '34',
'Sri Lanka (ex-Ceilan)' => '94',
'Sudan' => '249',
'Suriname' => '597',
'Svalbard and Jan Mayen Islands' => '79',
'Swaziland' => '41',
'Sweden' => '46',
'Switzerland' => '41',
'Syrian Arab Republic' => '963',
'Taiwan' => '886',
'Tajikistan' => '992',
'Tanzania' => '255',
'Thailand' => '66',
'Timor-Leste (East Timor)' => '670',
'Togo' => '228',
'Tokelau' => '690',
'Tonga' => '676',
'Trinidad and Tobago' => '1 868',
'Tunisia' => '216',
'Turkey' => '90',
'Turkmenistan' => '993',
'Turks and Caicos Islands' => '1 649',
'Tuvalu' => '688',
'Uganda' => '256',
'Ukraine' => '380',
'United Arab Emirates' => '971',
'United Kingdom' => '44',
'United States' => '1',
'US Minor Outlying Islands' => '808',
'Uruguay' => '598',
'Uzbekistan' => '998',
'Vanuatu' => '678',
'Vatican City State (Holy See)' => '379',
'Venezuela' => '58',
'Viet Nam' => '84',
'Virgin Islands, British' => '1284',
'Virgin Islands, U.S.' => '1340',
'Wallis and Futuna' => '681',
'Western Sahara' => '212',
'Yemen' => '967',
'Zambia' => '260',
'Zimbabwe' => '263',nerkn (08-04-2010 14:45) :
Pavel's code is much better. I'll use that with foreach to build selec element,
kazakistan and russia seems same dial code.
Perhaps best way is to keep in varchar formatAnonymous (26-05-2010 09:15) :
Useful. ThanksSaman (31-07-2010 00:58) :
Post a comment (fixed now)
See the array at http://www.expertcore.org/viewtopic.php?f=67&t=188 which has short country code as well.
This page was last modified on 2010-09-10 19:34:03