US States and World Countries Collection


 / Published in: PHP
 

This is a collection of US States (Long and abbreviated names) and world countries. There are a few examples of usage below the collections.

  1. //--------------------------------------------------------------------------------------------------------------------------------------
  2.  
  3. $states_abv_string = 'AL, AK, AZ, AR, CA, CO, CT, DE, FL, GA, HI, ID, IL, IN, IA, KS, KY, LA, ME, MD, MA, MI, MN, MS, MO, MT, NE, NV, NH, NJ, NM, NY, NC, ND, OH, OK, OR, PA, RI, SC, SD, TN, TX, UT, VT, VA, WA, WV, WI, WY';
  4. $states_string = 'Alabama, Alaska, Arizona, Arkansas, California, Colorado, Connecticut, Delaware, Florida, Georgia, Hawaii, Idaho, Illinois, Indiana, Iowa, Kansas, Kentucky, Louisiana, Maine, Maryland, Massachusetts, Michigan, Minnesota, Mississippi, Missouri, Montana, Nebraska, Nevada, New Hampshire, New Jersey, New Mexico, New York, North Carolina, North Dakota, Ohio, Oklahoma, Oregon, Pennsylvania, Rhode Island, South Carolina, South Dakota, Tennessee, Texas, Utah, Vermont, Virginia, Washington, West Virginia, Wisconsin, Wyoming';
  5. $countries_string = '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 Darussalam, Bulgaria, Burkina Faso, Burma, Burundi, Cambodia, Cameroon, Canada, Cape Verde, Central African Republic, Chad, Chile, China, Colombia, Comoros, Congo, Democratic Republic of the Congo, Costa Rica, Côte d\'Ivoire, Croatia, Cuba, Cyprus, Czech Republic, Denmark, Djibouti, Dominica, Dominican Republic, East Timor, Ecuador, Egypt, El Salvador, England, Equatorial Guinea, Eritrea, Estonia, Ethiopia, Fiji, Finland, France, Gabon, Gambia, Georgia, Germany, Ghana, Great Britain, Greece, Grenada, Guatemala, Guinea, Guinea-Bissau, Guyana, Haiti, Honduras, Hungary, Iceland, India, Indonesia, Iran, Iraq, Ireland, Israel, Italy, Jamaica, Japan, Jordan, Kazakhstan, Kenya, Kiribati, North Korea, South Korea, 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, Nepal, The Netherlands, New Zealand, Nicaragua, Niger, Nigeria, Northern Ireland, Norway, Oman, Pakistan, Palau, Palestinian State, Panama, Papua New Guinea, Paraguay, Peru, The Philippines, Poland, Portugal, Qatar, Romania, Russia, Rwanda, St. Kitts and Nevis, St. Lucia, St. Vincent and The Grenadines, Samoa, San Marino, São Tomé and Príncipe, Saudi Arabia, Scotland, 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, Wales, Western Sahara, Yemen, Yugoslavia, Zaire, Zambia';
  6.  
  7. //--------------------------------------------------------------------------------------------------------------------------------------
  8.  
  9. $state_list = Array('AL'=>'Alabama', 'AK'=>'Alaska', 'AZ'=>'Arizona', 'AR'=>'Arkansas', 'CA'=>'California', 'CO'=>'Colorado', 'CT'=>'Connecticut', 'DE'=>'Delaware', 'FL'=>'Florida', 'GA'=>'Georgia', 'HI'=>'Hawaii', 'ID'=>'Idaho', 'IL'=>'Illinois', 'IN'=>'Indiana', 'IA'=>'Iowa', 'KS'=>'Kansas', 'KY'=>'Kentucky', 'LA'=>'Louisiana', 'ME'=>'Maine', 'MD'=>'Maryland', 'MA'=>'Massachusetts', 'MI'=>'Michigan', 'MN'=>'Minnesota', 'MS'=>'Mississippi', 'MO'=>'Missouri', 'MT'=>'Montana', 'NE'=>'Nebraska', 'NV'=>'Nevada', 'NH'=>'New Hampshire', 'NJ'=>'New Jersey', 'NM'=>'New Mexico', 'NY'=>'New York', 'NC'=>'North Carolina', 'ND'=>'North Dakota', 'OH'=>'Ohio', 'OK'=>'Oklahoma', 'OR'=>'Oregon', 'PA'=>'Pennsylvania', 'RI'=>'Rhode Island', 'SC'=>'South Carolina', 'SD'=>'South Dakota', 'TN'=>'Tennessee', 'TX'=>'Texas', 'UT'=>'Utah', 'VT'=>'Vermont', 'VA'=>'Virginia', 'WA'=>'Washington', 'WV'=>'West Virginia', 'WI'=>'Wisconsin', 'WY'=>'Wyoming');
  10.  
  11. //--------------------------------------------------------------------------------------------------------------------------------------
  12.  
  13. $states = explode(', ', $states_abv_string);
  14. sort($states);
  15.  
  16. print('<select name="states">' . "\r\n");
  17. for ($i = 0; $i < count($states); $i++) { print('<option value="' . $states[$i] . '">' . $states[$i] . '</option>' . "\r\n"); }
  18. print('</select>' . "\r\n");
  19.  
  20. //--------------------------------------------------------------------------------------------------------------------------------------
  21.  
  22. $states = explode(', ', $states_string);
  23. sort($states);
  24.  
  25. print('<select name="states">' . "\r\n");
  26. for ($i = 0; $i < count($states); $i++) { print('<option value="' . $states[$i] . '">' . $states[$i] . '</option>' . "\r\n"); }
  27. print('</select>' . "\r\n");
  28.  
  29. //--------------------------------------------------------------------------------------------------------------------------------------
  30.  
  31. $countries = explode(', ', $countries_string);
  32. sort($countries);
  33.  
  34. print('<select name="countries">' . "\r\n");
  35. for ($i = 0; $i < count($countries); $i++) { print('<option value="' . $countries[$i] . '">' . $countries[$i] . '</option>' . "\r\n"); }
  36. print('</select>' . "\r\n");
  37.  
  38. //--------------------------------------------------------------------------------------------------------------------------------------

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: pr1001 on January 5, 2008

There are some duplicates in the countries list (e.g. London is in England, Great Britain, and United Kingdom, all of which are entries in the list) and some out of date entries (e.g. Serbia & Montenegro split). Here is my version: $countries_string = '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 Darussalam, Bulgaria, Burkina Faso, Burundi, Cambodia, Cameroon, Canada, Cape Verde, Central African Republic, Chad, Chile, China, Colombia, Comoros, Congo Brazzaville, Democratic Republic of the Congo, Costa Rica, Côte d\'Ivoire, Croatia, Cuba, Cyprus, Czech Republic, Denmark, Djibouti, Dominica, Dominican Republic, East Timor, Ecuador, Egypt, El Salvador, Equatorial Guinea, Eritrea, Estonia, Ethiopia, Fiji, Finland, France, Gabon, Gambia, 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, North Korea, South Korea, 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, Montenegro, Morocco, Mozambique, Myanmar, Namibia, Nauru, Nepal, The Netherlands, New Zealand, Nicaragua, Niger, Nigeria, Norway, Oman, Pakistan, Palau, Palestine, Panama, Papua New Guinea, Paraguay, Peru, The Philippines, Poland, Portugal, Qatar, Romania, Russia, Rwanda, St. Kitts and Nevis, St. Lucia, St. Vincent and The Grenadines, Samoa, San Marino, São Tomé and Príncipe, Saudi Arabia, Senegal, Serbia, 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, Western Sahara, Yemen, Zambia';

Posted By: nd6 on August 28, 2009

England, Great Britain, and United Kingdom are NOT the same...

England is a country within the island of Great Britain, and it is within the two islands that make up the United Kingdom

Posted By: chisler on June 17, 2010

The United Kingdom does not include the Republic of Ireland which is 80% of that 'other island'. Dont think Snipplr is the place for political discussions, however, the United Kingdom is actually the United Kingdom of Great Britain(made up of England, Wales and Scotland) and Northern Ireland - not 'two islands'. To refer to the two islands correctly you would call them the British Isles, although not many Irish people would appreciate that name.

Posted By: latope2014 on March 16, 2014

Injustice Gods Among Us Cheats 2014 [iPhone & iPad - No Jailbreak required]

http://www.injustice-cheats.id1945.com/ http://www.injustice-cheats.id1945.com/

Are you looking to download the Injustice: Gods Among Us Cheat? You are at the right place. Now with the help of Injustice: Gods Among Us Cheat Tool you can generate the Unlimited Power Credits in just a seconds. Remember that this Injustice: Gods Among Us Cheat is limited to only 861 users and after that you will not be able to download this Injustice: Gods Among Us Cheat. For downloading this cheat tool you can click the below download button.

You need to login to post a comment.