I am building an Worldwide Website. Customers can pick their country once they sign-up from the <select></select> area inside a form.

Presuming someone did not make use of the form to transmit the information towards the processing page where I validate the information, what 's better to do to see if the nation applies, to see an assortment or perhaps a database of nations? (All of the nations on the planet)

Programming language: PHP 5.3.5

Database: MySQL 5.

Because the country list is fairly static stuff, I believe that utilizing an array may be the best option.

Will you support all of the nations around the globe or simply a subset? Regardless just be sure you unset your array if not needed any longer, simply to release memory.

On the other hand a database could add a good way to attain more complete treatments for the nation list (consider adding a particular order or sort, or whatever) using SQL

It is dependent on the number of nations you support.
For those who have all of the nations, I'd opt for the database approach. Appears more maintainable. Could be up-to-date through exterior applications, unlike the hardcoded array which solve these questions . update by altering the code.

Also, using a database, you decouple the information in the code. By doing this it's not necessary to change and compile your code any time you give a country.

I'd make use of the array just for about 20 nations.

If you're to incorporate all of the nations (you will find ~196 nations on the planet), utilizing a database table to keep increase the information associated with the nations will be a conventional and fine design choice. It will likewise be simpler to keep the nation information by doing this.