PHP Array of US States
Snippet
US State abbreviations and names as PHP array:
$states = [
'AL'=>'Alabama',
'AK'=>'Alaska',
'AZ'=>'Arizona',
'AR'=>'Arkansas',
'CA'=>'California',
'CO'=>'Colorado',
'CT'=>'Connecticut',
'DE'=>'Delaware',
'DC'=>'District of Columbia',
'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',
];
With commonwealth and military:
// Commonwealth/Territory and Military
'AS' => 'American Samoa',
'DC' => 'District of Columbia',
'FM' => 'Federated States of Micronesia',
'GU' => 'Guam',
'MH' => 'Marshall Islands',
'MP' => 'Northern Mariana Islands',
'PW' => 'Palau',
'PR' => 'Puerto Rico',
'VI' => 'Virgin Islands',
'AA' => 'Armed Forces Americas',
'AE' => 'Armed Forces Canada / Europe / Middle East / Africa',
'AP' => 'Armed Forces Pacific',
Or:
$states = [
['code'=>'AL','name'=>'Alabama'],
['code'=>'AK','name'=>'Alaska'],
['code'=>'AZ','name'=>'Arizona'],
['code'=>'AR','name'=>'Arkansas'],
['code'=>'CA','name'=>'California'],
['code'=>'CO','name'=>'Colorado'],
['code'=>'CT','name'=>'Connecticut'],
['code'=>'DE','name'=>'Delaware'],
['code'=>'DC','name'=>'District of Columbia'],
['code'=>'FL','name'=>'Florida'],
['code'=>'GA','name'=>'Georgia'],
['code'=>'HI','name'=>'Hawaii'],
['code'=>'ID','name'=>'Idaho'],
['code'=>'IL','name'=>'Illinois'],
['code'=>'IN','name'=>'Indiana'],
['code'=>'IA','name'=>'Iowa'],
['code'=>'KS','name'=>'Kansas'],
['code'=>'KY','name'=>'Kentucky'],
['code'=>'LA','name'=>'Louisiana'],
['code'=>'ME','name'=>'Maine'],
['code'=>'MD','name'=>'Maryland'],
['code'=>'MA','name'=>'Massachusetts'],
['code'=>'MI','name'=>'Michigan'],
['code'=>'MN','name'=>'Minnesota'],
['code'=>'MS','name'=>'Mississippi'],
['code'=>'MO','name'=>'Missouri'],
['code'=>'MT','name'=>'Montana'],
['code'=>'NE','name'=>'Nebraska'],
['code'=>'NV','name'=>'Nevada'],
['code'=>'NH','name'=>'New Hampshire'],
['code'=>'NJ','name'=>'New Jersey'],
['code'=>'NM','name'=>'New Mexico'],
['code'=>'NY','name'=>'New York'],
['code'=>'NC','name'=>'North Carolina'],
['code'=>'ND','name'=>'North Dakota'],
['code'=>'OH','name'=>'Ohio'],
['code'=>'OK','name'=>'Oklahoma'],
['code'=>'OR','name'=>'Oregon'],
['code'=>'PA','name'=>'Pennsylvania'],
['code'=>'RI','name'=>'Rhode Island'],
['code'=>'SC','name'=>'South Carolina'],
['code'=>'SD','name'=>'South Dakota'],
['code'=>'TN','name'=>'Tennessee'],
['code'=>'TX','name'=>'Texas'],
['code'=>'UT','name'=>'Utah'],
['code'=>'VT','name'=>'Vermont'],
['code'=>'VA','name'=>'Virginia'],
['code'=>'WA','name'=>'Washington'],
['code'=>'WV','name'=>'West Virginia'],
['code'=>'WI','name'=>'Wisconsin'],
['code'=>'WY','name'=>'Wyoming'],
// Commonwealth/Territory and Military
['code'=>'AS','name' => 'American Samoa'],
['code'=>'DC','name' => 'District of Columbia'],
['code'=>'FM','name' => 'Federated States of Micronesia'],
['code'=>'GU','name' => 'Guam'],
['code'=>'MH','name' => 'Marshall Islands'],
['code'=>'MP','name' => 'Northern Mariana Islands'],
['code'=>'PW','name' => 'Palau'],
['code'=>'PR','name' => 'Puerto Rico'],
['code'=>'VI','name' => 'Virgin Islands'],
['code'=>'AA','name' => 'Armed Forces Americas'],
['code'=>'AE','name' => 'Armed Forces Canada / Europe / Middle East / Africa'],
['code'=>'AP','name' => 'Armed Forces Pacific'],
];
US State abbreviations as PHP array:
$usStateAbbrevs = ['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'];
US State abbreviations with commonwealth and military as PHP array:
$usStateAbbrevs = ['AL', 'AK', 'AS', 'AZ', 'AR', 'CA', 'CO', 'CT', 'DE', 'DC', 'FM', 'FL', 'GA', 'GU', 'HI', 'ID', 'IL', 'IN', 'IA', 'KS', 'KY', 'LA', 'ME', 'MH', 'MD', 'MA', 'MI', 'MN', 'MS', 'MO', 'MT', 'NE', 'NV', 'NH', 'NJ', 'NM', 'NY', 'NC', 'ND', 'MP', 'OH', 'OK', 'OR', 'PW', 'PA', 'PR', 'RI', 'SC', 'SD', 'TN', 'TX', 'UT', 'VT', 'VI', 'VA', 'WA', 'WV', 'WI', 'WY', 'AE', 'AA', 'AP'];
US State names as PHP array:
$states = [
'Alabama',
'Alaska',
'Arizona',
'Arkansas',
'California',
'Colorado',
'Connecticut',
'Delaware',
'District of Columbia',
'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',
// Commonwealth/Territory and Military
'American Samoa',
'District of Columbia',
'Federated States of Micronesia',
'Guam',
'Marshall Islands',
'Northern Mariana Islands',
'Palau',
'Puerto Rico',
'Virgin Islands',
'Armed Forces Americas',
'Armed Forces Canada / Europe / Middle East / Africa',
'Armed Forces Pacific',
];