Top Poster
#1 ramon fincken 397
#2 Site admin 3
#3 Ber|Art 2
#4 braddmark 1
#5 accentmedia 1
#6 Xarzu 1
#7 pEcosespedex 1
#8 khadish 1
#9 moxxx 1
#10 nistelrock 1
[snipplet] All countries in a PHP array



Rating : 3 / 5

 
Post new topic   Reply to topic    Ramonfincken.com Forum Index -> PHP coding
Beta
Want to be notified by email when this topic gets a reply?  
View previous topic :: View next topic  
Author Message
ramon fincken
Site's programmer

Get a free globally recognized avatar
It's free!


Joined: 03 Aug 2007
Posts: 397
Location: A'dam/Diemen, The Netherlands

PostPosted: Fri Dec 21, 2007 10:17 am    Post subject: [snipplet] All countries in a PHP array Reply with quote

This list is generated from the HTML list from:
http://snippets.dzone.com/posts/show/376
+
Code:
Replace:
<option value="

by:
$arraycountry[] = "

+
PHP-code:
Code:
$pattern = "!\">(.*?)</option>!is";
$replace = "\";";
$output = preg_replace($pattern, $replace, $input); 



Here we go:
Code:
// COUNTRIES
/*
 * HTML list from http://snippets.dzone.com/posts/show/376
 * Converted to PHP array by Ramon Fincken www.ramonfincken.com www.websitefreelancers.nl
 * http://www.ramonfincken.com/permalink/topic27.html
 */

$arraycountry = array ();
$arraycountry[] = "Please select your country";
$arraycountry[] = "Belgium";
$arraycountry[] = "Netherlands";
$arraycountry[] = "Germany";

$arraycountry[] = "United States";
$arraycountry[] = "United Kingdom";
$arraycountry[] = "-------";
$arraycountry[] = "Afghanistan";
$arraycountry[] = "Albania";
$arraycountry[] = "Algeria";
$arraycountry[] = "American Samoa";
$arraycountry[] = "Andorra";
$arraycountry[] = "Angola";
$arraycountry[] = "Anguilla";
$arraycountry[] = "Antarctica";
$arraycountry[] = "Antigua and Barbuda";
$arraycountry[] = "Argentina";
$arraycountry[] = "Armenia";
$arraycountry[] = "Aruba";
$arraycountry[] = "Australia";
$arraycountry[] = "Austria";
$arraycountry[] = "Azerbaijan";
$arraycountry[] = "Bahamas";
$arraycountry[] = "Bahrain";
$arraycountry[] = "Bangladesh";
$arraycountry[] = "Barbados";
$arraycountry[] = "Belarus";

$arraycountry[] = "Belize";
$arraycountry[] = "Benin";
$arraycountry[] = "Bermuda";
$arraycountry[] = "Bhutan";
$arraycountry[] = "Bolivia";
$arraycountry[] = "Bosnia and Herzegovina";
$arraycountry[] = "Botswana";
$arraycountry[] = "Bouvet Island";
$arraycountry[] = "Brazil";
$arraycountry[] = "British Indian Ocean Territory";
$arraycountry[] = "Brunei Darussalam";
$arraycountry[] = "Bulgaria";
$arraycountry[] = "Burkina Faso";
$arraycountry[] = "Burundi";
$arraycountry[] = "Cambodia";
$arraycountry[] = "Cameroon";
$arraycountry[] = "Canada";
$arraycountry[] = "Cape Verde";
$arraycountry[] = "Cayman Islands";
$arraycountry[] = "Central African Republic";
$arraycountry[] = "Chad";
$arraycountry[] = "Chile";
$arraycountry[] = "China";
$arraycountry[] = "Christmas Island";
$arraycountry[] = "Cocos (Keeling) Islands";
$arraycountry[] = "Colombia";
$arraycountry[] = "Comoros";
$arraycountry[] = "Congo";
$arraycountry[] = "Congo, The Democratic Republic of The";
$arraycountry[] = "Cook Islands";
$arraycountry[] = "Costa Rica";
$arraycountry[] = "Cote D'ivoire";
$arraycountry[] = "Croatia";
$arraycountry[] = "Cuba";
$arraycountry[] = "Cyprus";
$arraycountry[] = "Czech Republic";
$arraycountry[] = "Denmark";
$arraycountry[] = "Djibouti";
$arraycountry[] = "Dominica";
$arraycountry[] = "Dominican Republic";
$arraycountry[] = "Ecuador";
$arraycountry[] = "Egypt";
$arraycountry[] = "El Salvador";
$arraycountry[] = "Equatorial Guinea";
$arraycountry[] = "Eritrea";
$arraycountry[] = "Estonia";
$arraycountry[] = "Ethiopia";
$arraycountry[] = "Falkland Islands (Malvinas)";
$arraycountry[] = "Faroe Islands";
$arraycountry[] = "Fiji";
$arraycountry[] = "Finland";
$arraycountry[] = "France";
$arraycountry[] = "French Guiana";
$arraycountry[] = "French Polynesia";
$arraycountry[] = "French Southern Territories";
$arraycountry[] = "Gabon";
$arraycountry[] = "Gambia";
$arraycountry[] = "Georgia";

$arraycountry[] = "Ghana";
$arraycountry[] = "Gibraltar";
$arraycountry[] = "Greece";
$arraycountry[] = "Greenland";
$arraycountry[] = "Grenada";
$arraycountry[] = "Guadeloupe";
$arraycountry[] = "Guam";
$arraycountry[] = "Guatemala";
$arraycountry[] = "Guinea";
$arraycountry[] = "Guinea-bissau";
$arraycountry[] = "Guyana";
$arraycountry[] = "Haiti";
$arraycountry[] = "Heard Island and Mcdonald Islands";
$arraycountry[] = "Holy See (Vatican City State)";
$arraycountry[] = "Honduras";
$arraycountry[] = "Hong Kong";
$arraycountry[] = "Hungary";
$arraycountry[] = "Iceland";
$arraycountry[] = "India";
$arraycountry[] = "Indonesia";
$arraycountry[] = "Iran, Islamic Republic of";
$arraycountry[] = "Iraq";
$arraycountry[] = "Ireland";
$arraycountry[] = "Israel";
$arraycountry[] = "Italy";
$arraycountry[] = "Jamaica";
$arraycountry[] = "Japan";
$arraycountry[] = "Jordan";
$arraycountry[] = "Kazakhstan";
$arraycountry[] = "Kenya";
$arraycountry[] = "Kiribati";
$arraycountry[] = "Korea, Democratic People's Republic of";
$arraycountry[] = "Korea, Republic of";
$arraycountry[] = "Kuwait";
$arraycountry[] = "Kyrgyzstan";
$arraycountry[] = "Lao People's Democratic Republic";
$arraycountry[] = "Latvia";
$arraycountry[] = "Lebanon";
$arraycountry[] = "Lesotho";
$arraycountry[] = "Liberia";
$arraycountry[] = "Libyan Arab Jamahiriya";
$arraycountry[] = "Liechtenstein";
$arraycountry[] = "Lithuania";
$arraycountry[] = "Luxembourg";
$arraycountry[] = "Macao";
$arraycountry[] = "Macedonia, The Former Yugoslav Republic of";
$arraycountry[] = "Madagascar";
$arraycountry[] = "Malawi";
$arraycountry[] = "Malaysia";
$arraycountry[] = "Maldives";
$arraycountry[] = "Mali";
$arraycountry[] = "Malta";
$arraycountry[] = "Marshall Islands";
$arraycountry[] = "Martinique";
$arraycountry[] = "Mauritania";
$arraycountry[] = "Mauritius";
$arraycountry[] = "Mayotte";
$arraycountry[] = "Mexico";
$arraycountry[] = "Micronesia, Federated States of";
$arraycountry[] = "Moldova, Republic of";
$arraycountry[] = "Monaco";
$arraycountry[] = "Mongolia";
$arraycountry[] = "Montserrat";
$arraycountry[] = "Morocco";
$arraycountry[] = "Mozambique";
$arraycountry[] = "Myanmar";
$arraycountry[] = "Namibia";
$arraycountry[] = "Nauru";
$arraycountry[] = "Nepal";

$arraycountry[] = "Netherlands Antilles";
$arraycountry[] = "New Caledonia";
$arraycountry[] = "New Zealand";
$arraycountry[] = "Nicaragua";
$arraycountry[] = "Niger";
$arraycountry[] = "Nigeria";
$arraycountry[] = "Niue";
$arraycountry[] = "Norfolk Island";
$arraycountry[] = "Northern Mariana Islands";
$arraycountry[] = "Norway";
$arraycountry[] = "Oman";
$arraycountry[] = "Pakistan";
$arraycountry[] = "Palau";
$arraycountry[] = "Palestinian Territory, Occupied";
$arraycountry[] = "Panama";
$arraycountry[] = "Papua New Guinea";
$arraycountry[] = "Paraguay";
$arraycountry[] = "Peru";
$arraycountry[] = "Philippines";
$arraycountry[] = "Pitcairn";
$arraycountry[] = "Poland";
$arraycountry[] = "Portugal";
$arraycountry[] = "Puerto Rico";
$arraycountry[] = "Qatar";
$arraycountry[] = "Reunion";
$arraycountry[] = "Romania";
$arraycountry[] = "Russian Federation";
$arraycountry[] = "Rwanda";
$arraycountry[] = "Saint Helena";
$arraycountry[] = "Saint Kitts and Nevis";
$arraycountry[] = "Saint Lucia";
$arraycountry[] = "Saint Pierre and Miquelon";
$arraycountry[] = "Saint Vincent and The Grenadines";
$arraycountry[] = "Samoa";
$arraycountry[] = "San Marino";
$arraycountry[] = "Sao Tome and Principe";
$arraycountry[] = "Saudi Arabia";
$arraycountry[] = "Senegal";
$arraycountry[] = "Serbia and Montenegro";
$arraycountry[] = "Seychelles";
$arraycountry[] = "Sierra Leone";
$arraycountry[] = "Singapore";
$arraycountry[] = "Slovakia";
$arraycountry[] = "Slovenia";
$arraycountry[] = "Solomon Islands";
$arraycountry[] = "Somalia";
$arraycountry[] = "South Africa";
$arraycountry[] = "South Georgia and The South Sandwich Islands";
$arraycountry[] = "Spain";
$arraycountry[] = "Sri Lanka";
$arraycountry[] = "Sudan";
$arraycountry[] = "Suriname";
$arraycountry[] = "Svalbard and Jan Mayen";
$arraycountry[] = "Swaziland";
$arraycountry[] = "Sweden";
$arraycountry[] = "Switzerland";
$arraycountry[] = "Syrian Arab Republic";
$arraycountry[] = "Taiwan, Province of China";
$arraycountry[] = "Tajikistan";
$arraycountry[] = "Tanzania, United Republic of";
$arraycountry[] = "Thailand";
$arraycountry[] = "Timor-leste";
$arraycountry[] = "Togo";
$arraycountry[] = "Tokelau";
$arraycountry[] = "Tonga";
$arraycountry[] = "Trinidad and Tobago";
$arraycountry[] = "Tunisia";
$arraycountry[] = "Turkey";
$arraycountry[] = "Turkmenistan";
$arraycountry[] = "Turks and Caicos Islands";
$arraycountry[] = "Tuvalu";
$arraycountry[] = "Uganda";
$arraycountry[] = "Ukraine";
$arraycountry[] = "United Arab Emirates";
$arraycountry[] = "United Kingdom";
$arraycountry[] = "United States";
$arraycountry[] = "United States Minor Outlying Islands";
$arraycountry[] = "Uruguay";
$arraycountry[] = "Uzbekistan";
$arraycountry[] = "Vanuatu";
$arraycountry[] = "Venezuela";
$arraycountry[] = "Viet Nam";
$arraycountry[] = "Virgin Islands, British";
$arraycountry[] = "Virgin Islands, U.S.";
$arraycountry[] = "Wallis and Futuna";
$arraycountry[] = "Western Sahara";
$arraycountry[] = "Yemen";
$arraycountry[] = "Zambia";
$arraycountry[] = "Zimbabwe";
// COUNTRIES
Back to top
View user's profile Send private message Visit poster's website
Google adsense
Advertisement





PostPosted: Fri Dec 21, 2007 10:17 am    Post subject: [snipplet] All countries in a PHP array

Advertisement
Back to top
GravityForms
Advertisement





PostPosted: Fri Dec 21, 2007 10:17 am    Post subject: [snipplet] All countries in a PHP array

Advertisement
Gravity Forms Plugin for WordPress
Back to top
ramon fincken
Site's programmer

Get a free globally recognized avatar
It's free!


Joined: 03 Aug 2007
Posts: 397
Location: A'dam/Diemen, The Netherlands

PostPosted: Wed Apr 18, 2012 3:37 pm    Post subject: Re: [snipplet] All countries in a PHP array Reply with quote

Piped input for usage in WordPress S2member plugin:

Code:
Belgium|Belgium
Netherlands|Netherlands
Germany|Germany
United States|United States
United Kingdom|United Kingdom
Afghanistan|Afghanistan
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
Belize|Belize
Benin|Benin
Bermuda|Bermuda
Bhutan|Bhutan
Bolivia|Bolivia
Bosnia and Herzegovina|Bosnia and Herzegovina
Botswana|Botswana
Bouvet Island|Bouvet Island
Brazil|Brazil
British Indian Ocean Territory|British Indian Ocean Territory
Brunei Darussalam|Brunei Darussalam
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 (Keeling) Islands|Cocos (Keeling) Islands
Colombia|Colombia
Comoros|Comoros
Congo|Congo
Congo, The Democratic Republic of The|Congo, The Democratic Republic of The
Cook Islands|Cook Islands
Costa Rica|Costa Rica
Cote D'ivoire|Cote D'ivoire
Croatia|Croatia
Cuba|Cuba
Cyprus|Cyprus
Czech Republic|Czech Republic
Denmark|Denmark
Djibouti|Djibouti
Dominica|Dominica
Dominican Republic|Dominican Republic
Ecuador|Ecuador
Egypt|Egypt
El Salvador|El Salvador
Equatorial Guinea|Equatorial Guinea
Eritrea|Eritrea
Estonia|Estonia
Ethiopia|Ethiopia
Falkland Islands (Malvinas)|Falkland Islands (Malvinas)
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

Ghana|Ghana
Gibraltar|Gibraltar
Greece|Greece
Greenland|Greenland
Grenada|Grenada
Guadeloupe|Guadeloupe
Guam|Guam
Guatemala|Guatemala
Guinea|Guinea
Guinea-bissau|Guinea-bissau
Guyana|Guyana
Haiti|Haiti
Heard Island and Mcdonald Islands|Heard Island and Mcdonald Islands
Holy See (Vatican City State)|Holy See (Vatican City State)
Honduras|Honduras
Hong Kong|Hong Kong
Hungary|Hungary
Iceland|Iceland
India|India
Indonesia|Indonesia
Iran, Islamic Republic of|Iran, Islamic Republic of
Iraq|Iraq
Ireland|Ireland
Israel|Israel
Italy|Italy
Jamaica|Jamaica
Japan|Japan
Jordan|Jordan
Kazakhstan|Kazakhstan
Kenya|Kenya
Kiribati|Kiribati
Korea, Democratic People's Republic of|Korea, Democratic People's Republic of
Korea, Republic of|Korea, Republic of
Kuwait|Kuwait
Kyrgyzstan|Kyrgyzstan
Lao People's Democratic Republic|Lao People's Democratic Republic
Latvia|Latvia
Lebanon|Lebanon
Lesotho|Lesotho
Liberia|Liberia
Libyan Arab Jamahiriya|Libyan Arab Jamahiriya
Liechtenstein|Liechtenstein
Lithuania|Lithuania
Luxembourg|Luxembourg
Macao|Macao
Macedonia, The Former Yugoslav Republic of|Macedonia, The Former Yugoslav Republic of
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, Federated States of|Micronesia, Federated States of
Moldova, Republic of|Moldova, Republic of
Monaco|Monaco
Mongolia|Mongolia
Montserrat|Montserrat
Morocco|Morocco
Mozambique|Mozambique
Myanmar|Myanmar
Namibia|Namibia
Nauru|Nauru
Nepal|Nepal

Netherlands Antilles|Netherlands Antilles
New Caledonia|New Caledonia
New Zealand|New Zealand
Nicaragua|Nicaragua
Niger|Niger
Nigeria|Nigeria
Niue|Niue
Norfolk Island|Norfolk Island
Northern Mariana Islands|Northern Mariana Islands
Norway|Norway
Oman|Oman
Pakistan|Pakistan
Palau|Palau
Palestinian Territory, Occupied|Palestinian Territory, Occupied
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
Reunion|Reunion
Romania|Romania
Russian Federation|Russian Federation
Rwanda|Rwanda
Saint Helena|Saint Helena
Saint Kitts and Nevis|Saint Kitts and Nevis
Saint Lucia|Saint Lucia
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 and Montenegro|Serbia and Montenegro
Seychelles|Seychelles
Sierra Leone|Sierra Leone
Singapore|Singapore
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
Spain|Spain
Sri Lanka|Sri Lanka
Sudan|Sudan
Suriname|Suriname
Svalbard and Jan Mayen|Svalbard and Jan Mayen
Swaziland|Swaziland
Sweden|Sweden
Switzerland|Switzerland
Syrian Arab Republic|Syrian Arab Republic
Taiwan, Province of China|Taiwan, Province of China
Tajikistan|Tajikistan
Tanzania, United Republic of|Tanzania, United Republic of
Thailand|Thailand
Timor-leste|Timor-leste
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
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
Venezuela|Venezuela
Viet Nam|Viet Nam
Virgin Islands, British|Virgin Islands, British
Virgin Islands, U.S.|Virgin Islands, U.S.
Wallis and Futuna|Wallis and Futuna
Western Sahara|Western Sahara
Yemen|Yemen
Zambia|Zambia
Zimbabwe|Zimbabwe
Back to top
View user's profile Send private message Visit poster's website
Post new topic   Reply to topic    Ramonfincken.com Forum Index -> PHP coding All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
General forums
The world of freelance
Programming
Other projects
Poll
I love gifts

Yes goodies and presents! [3]
No but I love polls ! [1]

Related google ads