PHP Function for a List of States for HTML Forms

The following PHP function produces this textbox: 

It is useful for keeping your main code clean and legible—just stick this function in an external file and call it whenever necessary. It records the states as two-letter abbreviations and displays them in full. It can be easily edited to include any additional territories or converted to use for countries.

Be sure to also check out other pages in this section of my site if you are creating a database-driven site—I provide a MySQL state table somewhere in there.

// List the states in a select box to keep the main code clean.
function displayStateBox() {
     $states = array(

         array("AL", "Alabama"),
         array("AK", "Alaska"),
         array("AZ","Arizona"),
         array("AR","Arkansas"),
         array("CA","California"),
         array("CO","Colorado"),
         array("CT","Connecticut"),
         array("DE","Delaware"),
         array("DC","Dist of Columbia"),
         array("FL","Florida"),
         array("GA","Georgia"),
         array("HI","Hawaii"),
         array("ID","Idaho"),
         array("IL","Illinois"),
         array("IN","Indiana"),
         array("IA","Iowa"),
         array("KS","Kansas"),
         array("KY","Kentucky"),
         array("LA","Louisiana"),
         array("ME","Maine"),
         array("MD","Maryland"),
         array("MA","Massachusetts"),
         array("MI","Michigan"),
         array("MN","Minnesota"),
         array("MS","Mississippi"),
         array("MO","Missouri"),
         array("MT","Montana"),
         array("NE","Nebraska"),
         array("NV","Nevada"),
         array("NH","New Hampshire"),
         array("NJ","New Jersey"),
         array("NM","New Mexico"),
         array("NY","New York"),
         array("NC","North Carolina"),
         array("ND","North Dakota"),
         array("OH","Ohio"),
         array("OK","Oklahoma"),
         array("OR","Oregon"),
         array("PA","Pennsylvania"),
         array("RI","Rhode Island"),
         array("SC","South Carolina"),
         array("SD","South Dakota"),
         array("TN","Tennessee"),
         array("TX","Texas"),
         array("UT","Utah"),
         array("VT","Vermont"),
         array("VA","Virginia"),
         array("WA","Washington"),
         array("WV","West Virginia"),
         array("WI","Wisconsin"),
         array("WY","Wyoming")
);

     // Open the select box.
     print '<select name="state">' . "\n";

     // Uncomment the below line to make the first option "--SELECT--".
     // print '<option value="XX">--SELECT--</option>\n";

     // Cycle through the array, printing each option.
     foreach ($states as $s) {
         print '<option value="' . $s[0] . '"*gt;' . $s[1] . "</option>\n";
     }

     // Close the select box.
print "</select>\n";
} // End function displayStateBox()