Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
US State Names & Abbreviations as PHP Arrays
<?php
/* From https://www.usps.com/send/official-abbreviations.htm */
$us_state_abbrevs_names = array(
'AL'=>'ALABAMA',
'AK'=>'ALASKA',
'AS'=>'AMERICAN SAMOA',
'AZ'=>'ARIZONA',
'AR'=>'ARKANSAS',
'CA'=>'CALIFORNIA',
'CO'=>'COLORADO',
'CT'=>'CONNECTICUT',
'DE'=>'DELAWARE',
'DC'=>'DISTRICT OF COLUMBIA',
'FM'=>'FEDERATED STATES OF MICRONESIA',
'FL'=>'FLORIDA',
'GA'=>'GEORGIA',
'GU'=>'GUAM GU',
'HI'=>'HAWAII',
'ID'=>'IDAHO',
'IL'=>'ILLINOIS',
'IN'=>'INDIANA',
'IA'=>'IOWA',
'KS'=>'KANSAS',
'KY'=>'KENTUCKY',
'LA'=>'LOUISIANA',
'ME'=>'MAINE',
'MH'=>'MARSHALL ISLANDS',
'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',
'MP'=>'NORTHERN MARIANA ISLANDS',
'OH'=>'OHIO',
'OK'=>'OKLAHOMA',
'OR'=>'OREGON',
'PW'=>'PALAU',
'PA'=>'PENNSYLVANIA',
'PR'=>'PUERTO RICO',
'RI'=>'RHODE ISLAND',
'SC'=>'SOUTH CAROLINA',
'SD'=>'SOUTH DAKOTA',
'TN'=>'TENNESSEE',
'TX'=>'TEXAS',
'UT'=>'UTAH',
'VT'=>'VERMONT',
'VI'=>'VIRGIN ISLANDS',
'VA'=>'VIRGINIA',
'WA'=>'WASHINGTON',
'WV'=>'WEST VIRGINIA',
'WI'=>'WISCONSIN',
'WY'=>'WYOMING',
'AE'=>'ARMED FORCES AFRICA \ CANADA \ EUROPE \ MIDDLE EAST',
'AA'=>'ARMED FORCES AMERICA (EXCEPT CANADA)',
'AP'=>'ARMED FORCES PACIFIC'
);
?>
@charlex

This comment has been minimized.

Copy link

commented Jul 23, 2013

Thanks for this! For my needs, I had to retype them Capitalized and remove the territories. Here it is:

$states = array(
    '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',
);
@bnski

This comment has been minimized.

Copy link

commented Nov 20, 2013

Here is a quick re-shuffle with just the abbreviations.

$us_state_abbrevs = array('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');
@danberlyoung

This comment has been minimized.

Copy link

commented Feb 17, 2014

Here is the array reversed.

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

This comment has been minimized.

Copy link

commented Feb 26, 2014

And a function

    /**
     * Format State
     *
     * Note: Does not format addresses, only states. $input should be as exact as possible, problems
     * will probably arise in long strings, example 'I live in Kentukcy' will produce Indiana.
     *
     * @example echo myClass::format_state( 'Florida', 'abbr'); // FL
     * @example echo myClass::format_state( 'we\'re from georgia' ) // Georgia
     * 
     * @param  string $input  Input to be formatted
     * @param  string $format Accepts 'abbr' to output abbreviated state, default full state name.
     * @return string          Formatted state on success, 
     */
    static function format_state( $input, $format = '' ) {
        if( ! $input || empty( $input ) )
            return;

        $states = array (
            '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',
        );

        foreach( $states as $abbr => $name ) {
            if ( preg_match( "/\b($name)\b/", ucwords( strtolower( $input ) ), $match ) )  {
                if( 'abbr' == $format ){ 
                    return $abbr;
                } 
                else return $name;
            }
            elseif( preg_match("/\b($abbr)\b/", strtoupper( $input ), $match) ) {                    
                if( 'abbr' == $format ){ 
                    return $abbr;
                } 
                else return $name;
            } 
        }
        return;
    }
@ghost

This comment has been minimized.

Copy link

commented Mar 27, 2014

Here is the list without Delaware

$states = array(
'AL'=>'Alabama',
'AK'=>'Alaska',
'AZ'=>'Arizona',
'AR'=>'Arkansas',
'CA'=>'California',
'CO'=>'Colorado',
'CT'=>'Connecticut',
'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',
);

@nciske

This comment has been minimized.

Copy link

commented Apr 4, 2014

@HiSamn - WTH? What do you have against Delware? ;-)

@spedinfargo

This comment has been minimized.

Copy link

commented Jun 3, 2014

HiSamn, not sure if you'll ever see this, but holy crap you just gave me a headache from laughing so hard. Nicely done.

@yalamber

This comment has been minimized.

Copy link

commented Jun 9, 2014

Here is alphabetically indexed states array.

$indexed_states_array = array (
        'A' =>
            array (
                0 => 'Alabama',
                1 => 'Alaska',
                2 => 'Arizona',
                3 => 'Arkansas',
            ),
        'C' =>
            array (
                0 => 'California',
                1 => 'Colorado',
                2 => 'Connecticut',
            ),
        'D' =>
            array (
                0 => 'Delaware',
                1 => 'District of Columbia',
            ),
        'F' =>
            array (
                0 => 'Florida',
            ),
        'G' =>
            array (
                0 => 'Georgia',
            ),
        'H' =>
            array (
                0 => 'Hawaii',
            ),
        'I' =>
            array (
                0 => 'Idaho',
                1 => 'Illinois',
                2 => 'Indiana',
                3 => 'Iowa',
            ),
        'K' =>
            array (
                0 => 'Kansas',
                1 => 'Kentucky',
            ),
        'L' =>
            array (
                0 => 'Louisiana',
            ),
        'M' =>
            array (
                0 => 'Maine',
                1 => 'Maryland',
                2 => 'Massachusetts',
                3 => 'Michigan',
                4 => 'Minnesota',
                5 => 'Mississippi',
                6 => 'Missouri',
                7 => 'Montana',
            ),
        'N' =>
            array (
                0 => 'Nebraska',
                1 => 'Nevada',
                2 => 'New Hampshire',
                3 => 'New Jersey',
                4 => 'New Mexico',
                5 => 'New York',
                6 => 'North Carolina',
                7 => 'North Dakota',
            ),
        'O' =>
            array (
                0 => 'Ohio',
                1 => 'Oklahoma',
                2 => 'Oregon',
            ),
        'P' =>
            array (
                0 => 'Pennsylvania',
            ),
        'R' =>
            array (
                0 => 'Rhode Island',
            ),
        'S' =>
            array (
                0 => 'South Carolina',
                1 => 'South Dakota',
            ),
        'T' =>
            array (
                0 => 'Tennessee',
                1 => 'Texas',
            ),
        'U' =>
            array (
                0 => 'Utah',
            ),
        'V' =>
            array (
                0 => 'Vermont',
                1 => 'Virginia',
            ),
        'W' =>
            array (
                0 => 'Washington',
                1 => 'West Virginia',
                2 => 'Wisconsin',
                3 => 'Wyoming',
            )
    );
@morganestes

This comment has been minimized.

Copy link

commented Jul 30, 2014

With Puerto Rico, US Virgin Islands, and alternate Washington DC.

$states = array(
            'AL' => 'Alabama',
            'AK' => 'Alaska',
            'AZ' => 'Arizona',
            'AR' => 'Arkansas',
            'CA' => 'California',
            'CO' => 'Colorado',
            'CT' => 'Connecticut',
            'DE' => 'Delaware',
            'DC' => 'Washington DC',
            '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',
            'PR' => 'Puerto Rico',
            'RI' => 'Rhode Island',
            'SC' => 'South Carolina',
            'SD' => 'South Dakota',
            'TN' => 'Tennessee',
            'TX' => 'Texas',
            'UT' => 'Utah',
            'VT' => 'Vermont',
            'VI' => 'Virgin Islands',
            'VA' => 'Virginia',
            'WA' => 'Washington',
            'WV' => 'West Virginia',
            'WI' => 'Wisconsin',
            'WY' => 'Wyoming',
        );
@Adeelgill

This comment has been minimized.

Copy link

commented Oct 2, 2014

As per my requirement
$states = array('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',);

@imjohnbon

This comment has been minimized.

Copy link

commented Oct 21, 2014

Array where abbreviations are the key and value:

$states = array(
    'AL'=>'AL',
    'AK'=>'AK',
    'AS'=>'AS',
    'AZ'=>'AZ',
    'AR'=>'AR',
    'CA'=>'CA',
    'CO'=>'CO',
    'CT'=>'CT',
    'DE'=>'DE',
    'DC'=>'DC',
    'FM'=>'FM',
    'FL'=>'FL',
    'GA'=>'GA',
    'GU'=>'GU',
    'HI'=>'HI',
    'ID'=>'ID',
    'IL'=>'IL',
    'IN'=>'IN',
    'IA'=>'IA',
    'KS'=>'KS',
    'KY'=>'KY',
    'LA'=>'LA',
    'ME'=>'ME',
    'MH'=>'MH',
    'MD'=>'MD',
    'MA'=>'MA',
    'MI'=>'MI',
    'MN'=>'MN',
    'MS'=>'MS',
    'MO'=>'MO',
    'MT'=>'MT',
    'NE'=>'NE',
    'NV'=>'NV',
    'NH'=>'NH',
    'NJ'=>'NJ',
    'NM'=>'NM',
    'NY'=>'NY',
    'NC'=>'NC',
    'ND'=>'ND',
    'MP'=>'MP',
    'OH'=>'OH',
    'OK'=>'OK',
    'OR'=>'OR',
    'PW'=>'PW',
    'PA'=>'PA',
    'PR'=>'PR',
    'RI'=>'RI',
    'SC'=>'SC',
    'SD'=>'SD',
    'TN'=>'TN',
    'TX'=>'TX',
    'UT'=>'UT',
    'VT'=>'VT',
    'VI'=>'VI',
    'VA'=>'VA',
    'WA'=>'WA',
    'WV'=>'WV',
    'WI'=>'WI',
    'WY'=>'WY',
    'AE'=>'AE',
    'AA'=>'AA',
    'AP'=>'AP'
);
@brs14ku

This comment has been minimized.

Copy link

commented Oct 31, 2014

For my purposes I needed an array of state arrays that I could add data for each state into each respective array.

      $states = array(
            array('Alabama'),
            array('Alaska'),
            array('Arizona'),
            array('Arkansas'),
            array('California'),
            array('Colorado'),
            array('Connecticut'),
            array('Delaware'),
            array('District of Columbia'),
            array('Florida'),
            array('Georgia'),
            array('Hawaii'),
            array('Idaho'),
            array('Illinois'),
            array('Indiana'),
            array('Iowa'),
            array('Kansas'),
            array('Kentucky'),
            array('Louisiana'),
            array('Maine'),
            array('Maryland'),
            array('Massachusetts'),
            array('Michigan'),
            array('Minnesota'),
            array('Mississippi'),
            array('Missouri'),
            array('Montana'),
            array('Nebraska'),
            array('Nevada'),
            array('New Hampshire'),
            array('New Jersey'),
            array('New Mexico'),
            array('New York'),
            array('North Carolina'),
            array('North Dakota'),
            array('Ohio'),
            array('Oklahoma'),
            array('Oregon'),
            array('Pennsylvania'),
            array('Rhode Island'),
            array('South Carolina'),
            array('South Dakota'),
            array('Tennessee'),
            array('Texas'),
            array('Utah'),
            array('Vermont'),
            array('Virginia'),
            array('Washington'),
            array('West Virginia'),
            array('Wisconsin'),
            array('Wyoming')
        );
@alanpuccinelli

This comment has been minimized.

Copy link

commented Nov 6, 2014

Here's the six Californias that will never exist in an array with a demographic key:

$six_californias = array(
  'Potheads' => 'Jefferson',
  'Pretentious Douchebags' => 'North California',
  'Rich Assholes' => Silicon Valley,
  'Hee-haws' => Central California,
  'Hippies' =>  'West California',
  'Movie Stars and Gangsters' => 'South California'
);
@garyhussey

This comment has been minimized.

Copy link

commented Dec 3, 2014

Laravel states Form::select() with Input::old and attributes.

Form::select('state',array(
    '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',
) , 
Input::old('state'), 
array(
    'class'       => 'form-control'
))
@blackstalk

This comment has been minimized.

Copy link

commented Dec 17, 2014

Here are the States in an array with Latitude Longitude Coordinates. Helpful when using google maps api

$statesCoord = array(
        'AL'=>'32.6010112,-86.6807365',
        'AK'=>'61.3025006,-158.7750198',
        'AZ'=>'34.1682185,-111.930907',
        'AR'=>'34.7519275,-92.1313784',
        'CA'=>'37.2718745,-119.2704153',
        'CO'=>'38.9979339,-105.550567',
        'CT'=>'41.5187835,-72.757507',
        'DE'=>'39.145251,-75.4189206',
        'DC'=>'38.8993487,-77.0145666',
        'FL'=>'27.9757279,-83.8330166',
        'GA'=>'32.6781248,-83.2229757',
        'HI'=>'20.46,-157.505',
        'ID'=>'45.4945756,-114.1424303',
        'IL'=>'39.739318,-89.504139',
        'IN'=>'39.7662195,-86.441277',
        'IA'=>'41.9383166,-93.389798',
        'KS'=>'38.4987789,-98.3200779',
        'KY'=>'37.8222935,-85.7682399',
        'LA'=>'30.9733766,-91.4299097',
        'ME'=>'45.2185133,-69.0148656',
        'MD'=>'38.8063524,-77.2684162',
        'MA'=>'42.0629398,-71.718067',
        'MI'=>'44.9435598,-86.4158049',
        'MN'=>'46.4418595,-93.3655146',
        'MS'=>'32.5851062,-89.8772196',
        'MO'=>'38.3046615,-92.437099',
        'MT'=>'46.6797995,-110.044783',
        'NE'=>'41.5008195,-99.680902',
        'NV'=>'38.502032,-117.0230604',
        'NH'=>'44.0012306,-71.5799231',
        'NJ'=>'40.1430058,-74.7311156',
        'NM'=>'34.1662325,-106.0260685',
        'NY'=>'40.7056258,-73.97968',
        'NC'=>'35.2145629,-79.8912675',
        'ND'=>'47.4678819,-100.3022655',
        'OH'=>'40.1903624,-82.6692525',
        'OK'=>'35.3097654,-98.7165585',
        'OR'=>'44.1419049,-120.5380993',
        'PA'=>'40.9945928,-77.6046984',
        'RI'=>'41.5827282,-71.5064508',
        'SC'=>'33.62505,-80.9470381',
        'SD'=>'44.2126995,-100.2471641',
        'TN'=>'35.830521,-85.9785989',
        'TX'=>'31.1693363,-100.0768425',
        'UT'=>'39.4997605,-111.547028',
        'VT'=>'43.8717545,-72.4477828',
        'VA'=>'38.0033855,-79.4587861',
        'WA'=>'38.8993487,-77.0145665',
        'WV'=>'38.9201705,-80.1816905',
        'WI'=>'44.7862968,-89.8267049',
        'WY'=>'43.000325,-107.5545669',
    );
@jserle

This comment has been minimized.

Copy link

commented Feb 18, 2015

FYI the USPS has moved its official list. It is now here: http://pe.usps.gov/text/pub28/28apb.htm

@katart

This comment has been minimized.

Copy link

commented Mar 27, 2015

I created a PHP Switch statement for US States. Is there a better way to do this?

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

This comment has been minimized.

Copy link

commented Apr 3, 2015

$states_full_key = array(
    "Alabama" => "Alabama",
    "Alaska" => "Alaska",
    "Arizona" => "Arizona",
    "Arkansas" => "Arkansas",
    "California" => "California",
    "Colorado" => "Colorado",
    "Connecticut" => "Connecticut",
    "Delaware" => "Delaware",
    "District of Columbia" => "District of Columbia",
    "Florida" => "Florida",
    "Georgia" => "Georgia",
    "Hawaii" => "Hawaii",
    "Idaho" => "Idaho",
    "Illinois" => "Illinois",
    "Indiana" => "Indiana",
    "Iowa" => "Iowa",
    "Kansas" => "Kansas",
    "Kentucky" => "Kentucky",
    "Louisiana" => "Louisiana",
    "Maine" => "Maine",
    "Maryland" => "Maryland",
    "Massachusetts" => "Massachusetts",
    "Michigan" => "Michigan",
    "Minnesota" => "Minnesota",
    "Mississippi" => "Mississippi",
    "Missouri" => "Missouri",
    "Montana" => "Montana",
    "Nebraska" => "Nebraska",
    "Nevada" => "Nevada",
    "New Hampshire" => "New Hampshire",
    "New Jersey" => "New Jersey",
    "New Mexico" => "New Mexico",
    "New York" => "New York",
    "North Carolina" => "North Carolina",
    "North Dakota" => "North Dakota",
    "Ohio" => "Ohio",
    "Oklahoma" => "Oklahoma",
    "Oregon" => "Oregon",
    "Pennsylvania" => "Pennsylvania",
    "Rhode Island" => "Rhode Island",
    "South Carolina" => "South Carolina",
    "South Dakota" => "South Dakota",
    "Tennessee" => "Tennessee",
    "Texas" => "Texas",
    "Utah" => "Utah",
    "Vermont" => "Vermont",
    "Virginia" => "Virginia",
    "Washington" => "Washington",
    "West Virginia" => "West Virginia",
    "Wisconsin" => "Wisconsin",
    "Wyoming" => "Wyoming"
)

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

$states_grouped_full_key = array(
    "A" => array(
        "Alabama" => "Alabama",
        "Alaska" => "Alaska",
        "Arizona" => "Arizona",
        "Arkansas" => "Arkansas"
    ),
    "C" => array(
        "California" => "California",
        "Colorado" => "Colorado",
        "Connecticut" => "Connecticut"
    ),
    "D" => array(
        "Delaware" => "Delaware",
        "District of Columbia" => "District of Columbia"
    ),
    "F" => array(
        "Florida" => "Florida"
    ),
    "G" => array(
        "Georgia" => "Georgia"
    ),
    "H" => array(
        "Hawaii" => "Hawaii"
    ),
    "I" => array(
        "Idaho" => "Idaho",
        "Illinois" => "Illinois",
        "Indiana" => "Indiana",
        "Iowa" => "Iowa"
    ),
    "K" => array(
        "Kansas" => "Kansas",
        "Kentucky" => "Kentucky"
    ),
    "L" => array(
        "Louisiana" => "Louisiana"
    ),
    "M" => array(
        "Maine" => "Maine",
        "Maryland" => "Maryland",
        "Massachusetts" => "Massachusetts",
        "Michigan" => "Michigan",
        "Minnesota" => "Minnesota",
        "Mississippi" => "Mississippi",
        "Missouri" => "Missouri",
        "Montana" => "Montana"
    ),
    "N" => array(
        "Nebraska" => "Nebraska",
        "Nevada" => "Nevada",
        "New Hampshire" => "New Hampshire",
        "New Jersey" => "New Jersey",
        "New Mexico" => "New Mexico",
        "New York" => "New York",
        "North Carolina" => "North Carolina",
        "North Dakota" => "North Dakota"
    ),
    "O" => array(
        "Ohio" => "Ohio",
        "Oklahoma" => "Oklahoma",
        "Oregon" => "Oregon"
    ),
    "P" => array(
        "Pennsylvania" => "Pennsylvania"
    ),
    "R" => array(
        "Rhode Island" => "Rhode Island"
    ),
    "S" => array(
        "South Carolina" => "South Carolina",
        "South Dakota" => "South Dakota"
    ),
    "T" => array(
        "Tennessee" => "Tennessee",
        "Texas" => "Texas"
    ),
    "U" => array(
        "Utah" => "Utah"
    ),
    "V" => array(
        "Vermont" => "Vermont",
        "Virginia" => "Virginia"
    ),
    "W" => array(
        "Washington" => "Washington",
        "West Virginia" => "West Virginia",
        "Wisconsin" => "Wisconsin",
        "Wyoming" => "Wyoming"
    )
)

Theres an array of every kind of state array youd need

@kazoto

This comment has been minimized.

Copy link

commented Apr 3, 2015

<?php if( !defined( 'ABSPATH' ) ) die( 'no direct access' );

class GroSourceStates {
    var $states = array(
        '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'
    );

    var $states_full_key = array(
        "Alabama" => "Alabama",
        "Alaska" => "Alaska",
        "Arizona" => "Arizona",
        "Arkansas" => "Arkansas",
        "California" => "California",
        "Colorado" => "Colorado",
        "Connecticut" => "Connecticut",
        "Delaware" => "Delaware",
        "District of Columbia" => "District of Columbia",
        "Florida" => "Florida",
        "Georgia" => "Georgia",
        "Hawaii" => "Hawaii",
        "Idaho" => "Idaho",
        "Illinois" => "Illinois",
        "Indiana" => "Indiana",
        "Iowa" => "Iowa",
        "Kansas" => "Kansas",
        "Kentucky" => "Kentucky",
        "Louisiana" => "Louisiana",
        "Maine" => "Maine",
        "Maryland" => "Maryland",
        "Massachusetts" => "Massachusetts",
        "Michigan" => "Michigan",
        "Minnesota" => "Minnesota",
        "Mississippi" => "Mississippi",
        "Missouri" => "Missouri",
        "Montana" => "Montana",
        "Nebraska" => "Nebraska",
        "Nevada" => "Nevada",
        "New Hampshire" => "New Hampshire",
        "New Jersey" => "New Jersey",
        "New Mexico" => "New Mexico",
        "New York" => "New York",
        "North Carolina" => "North Carolina",
        "North Dakota" => "North Dakota",
        "Ohio" => "Ohio",
        "Oklahoma" => "Oklahoma",
        "Oregon" => "Oregon",
        "Pennsylvania" => "Pennsylvania",
        "Rhode Island" => "Rhode Island",
        "South Carolina" => "South Carolina",
        "South Dakota" => "South Dakota",
        "Tennessee" => "Tennessee",
        "Texas" => "Texas",
        "Utah" => "Utah",
        "Vermont" => "Vermont",
        "Virginia" => "Virginia",
        "Washington" => "Washington",
        "West Virginia" => "West Virginia",
        "Wisconsin" => "Wisconsin",
        "Wyoming" => "Wyoming"
    );

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

    var $states_grouped_full_key = array(
        "A" => array(
            "Alabama" => "Alabama",
            "Alaska" => "Alaska",
            "Arizona" => "Arizona",
            "Arkansas" => "Arkansas"
        ),
        "C" => array(
            "California" => "California",
            "Colorado" => "Colorado",
            "Connecticut" => "Connecticut"
        ),
        "D" => array(
            "Delaware" => "Delaware",
            "District of Columbia" => "District of Columbia"
        ),
        "F" => array(
            "Florida" => "Florida"
        ),
        "G" => array(
            "Georgia" => "Georgia"
        ),
        "H" => array(
            "Hawaii" => "Hawaii"
        ),
        "I" => array(
            "Idaho" => "Idaho",
            "Illinois" => "Illinois",
            "Indiana" => "Indiana",
            "Iowa" => "Iowa"
        ),
        "K" => array(
            "Kansas" => "Kansas",
            "Kentucky" => "Kentucky"
        ),
        "L" => array(
            "Louisiana" => "Louisiana"
        ),
        "M" => array(
            "Maine" => "Maine",
            "Maryland" => "Maryland",
            "Massachusetts" => "Massachusetts",
            "Michigan" => "Michigan",
            "Minnesota" => "Minnesota",
            "Mississippi" => "Mississippi",
            "Missouri" => "Missouri",
            "Montana" => "Montana"
        ),
        "N" => array(
            "Nebraska" => "Nebraska",
            "Nevada" => "Nevada",
            "New Hampshire" => "New Hampshire",
            "New Jersey" => "New Jersey",
            "New Mexico" => "New Mexico",
            "New York" => "New York",
            "North Carolina" => "North Carolina",
            "North Dakota" => "North Dakota"
        ),
        "O" => array(
            "Ohio" => "Ohio",
            "Oklahoma" => "Oklahoma",
            "Oregon" => "Oregon"
        ),
        "P" => array(
            "Pennsylvania" => "Pennsylvania"
        ),
        "R" => array(
            "Rhode Island" => "Rhode Island"
        ),
        "S" => array(
            "South Carolina" => "South Carolina",
            "South Dakota" => "South Dakota"
        ),
        "T" => array(
            "Tennessee" => "Tennessee",
            "Texas" => "Texas"
        ),
        "U" => array(
            "Utah" => "Utah"
        ),
        "V" => array(
            "Vermont" => "Vermont",
            "Virginia" => "Virginia"
        ),
        "W" => array(
            "Washington" => "Washington",
            "West Virginia" => "West Virginia",
            "Wisconsin" => "Wisconsin",
            "Wyoming" => "Wyoming"
        )
    );

    function get_state( $var = 'states', $key = null, $subkey = null ){

        if( !empty( $subkey ) && !empty( $var ) && !empty( $key ) ){
            return $this->$var[$key][$subkey];
        }

        if( !empty( $var ) && !empty( $key ) ){
            return $this->$var[$key];
        }

        if( !empty( $var ) ){
            return $this->$var;
        }

        return $this->states;
    }

}

add_action( 'init', function(){
    global $GroSourceStates;
    $GroSourceStates = new GroSourceStates();
});

And heres an object for the above.

Usage:

// For returning just states:
function someFunc(){
    global $GroSourceStates;
    $states = $GroSourceStates->get_state();
}

// For returning a particular array:
function someFunc(){
    global $GroSourceStates;
    $states = $GroSourceStates->get_state( 'states_grouped' );
    // Returns grouped states array;
}

// For returning a particular key
function someFunc(){
    global $GroSourceStates;
    $states = $GroSourceStates->get_state('states_grouped', 'W');
    // Returns array in $states_grouped var in W key.
}

// For returning a particular subkey
function someFunc(){
    global $GroSourceStates;
    $states = $GroSourceStates->get_state('states_grouped_full_key', 'W', 'Wyoming');
    // Returns array in $states_grouped var in W key.
}

Enjoy

@watzon

This comment has been minimized.

Copy link

commented May 9, 2015

For my purposes (using simple_form in a rails app) I needed the list to look like this:

[
        ['AL', 'AL'],
        ['AK', 'AK'],
        ['AS', 'AS'],
        ['AZ', 'AZ'],
        ['AR', 'AR'],
        ['CA', 'CA'],
        ['CO', 'CO'],
        ['CT', 'CT'],
        ['DE', 'DE'],
        ['DC', 'DC'],
        ['FM', 'FM'],
        ['FL', 'FL'],
        ['GA', 'GA'],
        ['GU', 'GU'],
        ['HI', 'HI'],
        ['ID', 'ID'],
        ['IL', 'IL'],
        ['IN', 'IN'],
        ['IA', 'IA'],
        ['KS', 'KS'],
        ['KY', 'KY'],
        ['LA', 'LA'],
        ['ME', 'ME'],
        ['MH', 'MH'],
        ['MD', 'MD'],
        ['MA', 'MA'],
        ['MI', 'MI'],
        ['MN', 'MN'],
        ['MS', 'MS'],
        ['MO', 'MO'],
        ['MT', 'MT'],
        ['NE', 'NE'],
        ['NV', 'NV'],
        ['NH', 'NH'],
        ['NJ', 'NJ'],
        ['NM', 'NM'],
        ['NY', 'NY'],
        ['NC', 'NC'],
        ['ND', 'ND'],
        ['MP', 'MP'],
        ['OH', 'OH'],
        ['OK', 'OK'],
        ['OR', 'OR'],
        ['PW', 'PW'],
        ['PA', 'PA'],
        ['PR', 'PR'],
        ['RI', 'RI'],
        ['SC', 'SC'],
        ['SD', 'SD'],
        ['TN', 'TN'],
        ['TX', 'TX'],
        ['UT', 'UT'],
        ['VT', 'VT'],
        ['VI', 'VI'],
        ['VA', 'VA'],
        ['WA', 'WA'],
        ['WV', 'WV'],
        ['WI', 'WI'],
        ['WY', 'WY'],
        ['AE', 'AE'],
        ['AA', 'AA'],
        ['AP', 'AP']
    ]

Hope it helps someone

@austinkregel

This comment has been minimized.

Copy link

commented May 26, 2015

I literally just needed an array of abbreviations with all states including Washington DC.

$abr = array(
  'AK',
  'AL',
  'AR',
  'AZ',
  'CA',
  'CO',
  'CT',
  'DC',
  'DE',
  'FL',
  'GA',
  'HI',
  'IA',
  'ID',
  'IL',
  'IN',
  'KS',
  'KY',
  'LA',
  'MA',
  'MD',
  'ME',
  'MI',
  'MN',
  'MO',
  'MS',
  'MT',
  'NC',
  'ND',
  'NE',
  'NH',
  'NJ',
  'NM',
  'NV',
  'NY',
  'OH',
  'OK',
  'OR',
  'PA',
  'RI',
  'SC',
  'SD',
  'TN',
  'TX',
  'UT',
  'VA',
  'VT',
  'WA',
  'WI',
  'WV',
  'WY'
);
@paamayim

This comment has been minimized.

Copy link

commented Aug 10, 2015

None of the above lists include all states according to https://en.wikipedia.org/wiki/List_of_U.S._state_abbreviations

Here's the added:

$states_initials2full = array(
    'us'=>'United 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',
    'as'=>'American Samoa',
    'gu'=>'Guam',
    'mp'=>'Northern Mariana Islands',
    'pr'=>'Puerto Rico',
    'vi'=>'Virgin Islands',
    'um'=>'U.S. Minor Outlying Islands',
    'fm'=>'Federated States of Micronesia',
    'mh'=>'Marshall Islands',
    'pw'=>'Palau',
    'aa'=>'U.S. Armed Forces – Americas',
    'ae'=>'U.S. Armed Forces – Europe',
    'ap'=>'U.S. Armed Forces – Pacific',
    'cm'=>'Northern Mariana Islands',
    'cz'=>'Panama Canal Zone',
    'nb'=>'Nebraska',
    'pi'=>'Philippine Islands',
    'tt'=>'Trust Territory of the Pacific Islands'
);
@drg809

This comment has been minimized.

Copy link

commented Aug 30, 2015

I need a list of the states loc and lon by poligons, someone has it? thank a lot.

@bannostookaylo

This comment has been minimized.

Copy link

commented Sep 2, 2015

I needed a JSON Object for JS figured I'd share it with this list

{"AL":"ALABAMA","AK":"ALASKA","AS":"AMERICAN SAMOA","AZ":"ARIZONA","AR":"ARKANSAS","CA":"CALIFORNIA","CO":"COLORADO","CT":"CONNECTICUT","DE":"DELAWARE","DC":"DISTRICT OF COLUMBIA","FM":"FEDERATED STATES OF MICRONESIA","FL":"FLORIDA","GA":"GEORGIA","GU":"GUAM GU","HI":"HAWAII","ID":"IDAHO","IL":"ILLINOIS","IN":"INDIANA","IA":"IOWA","KS":"KANSAS","KY":"KENTUCKY","LA":"LOUISIANA","ME":"MAINE","MH":"MARSHALL ISLANDS","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","MP":"NORTHERN MARIANA ISLANDS","OH":"OHIO","OK":"OKLAHOMA","OR":"OREGON","PW":"PALAU","PA":"PENNSYLVANIA","PR":"PUERTO RICO","RI":"RHODE ISLAND","SC":"SOUTH CAROLINA","SD":"SOUTH DAKOTA","TN":"TENNESSEE","TX":"TEXAS","UT":"UTAH","VT":"VERMONT","VI":"VIRGIN ISLANDS","VA":"VIRGINIA","WA":"WASHINGTON","WV":"WEST VIRGINIA","WI":"WISCONSIN","WY":"WYOMING","AE":"ARMED FORCES AFRICA \/ CANADA \/ EUROPE \/ MIDDLE EAST","AA":"ARMED FORCES AMERICA (EXCEPT CANADA)","AP":"ARMED FORCES PACIFIC"}
@hansondr

This comment has been minimized.

Copy link

commented Sep 17, 2015

Simple array of state names:

[
  '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'
]
@salaback

This comment has been minimized.

Copy link

commented Nov 15, 2015

Here's a list of states according to New Yorkers. But I'm excluding Florida, because ... it's Flordia.

$states = array(
    'CA'=>'California'
    'CT'=>'Connecticut',
    'NJ'=>'New Jersey',
    'NY'=>'New York',
    'NYC' => 'New York City',
    'O'=>'Other'
);
@ranierimachado

This comment has been minimized.

Copy link

commented Nov 18, 2015

With US territories:
$state_abr = array(
'AK', 'AL', 'AR', 'AZ', 'CA', 'CO', 'CT', 'DC', 'DE', 'FL', 'GA', 'HI',
'IA', 'ID', 'IL', 'IN', 'KS', 'KY', 'LA', 'MA', 'MD', 'ME', 'MI', 'MN',
'MO', 'MS', 'MT', 'NC', 'ND', 'NE', 'NH', 'NJ', 'NM', 'NV', 'NY', 'OH',
'OK', 'OR', 'PA', 'RI', 'SC', 'SD', 'TN', 'TX', 'UT', 'VA', 'VT', 'WA',
'WI', 'WV', 'WY', 'AS', 'GU', 'MP', 'PR', 'VI', 'UM', 'FM', 'MH', 'PW'
);

@jomo

This comment has been minimized.

Copy link

commented Dec 10, 2015

List of states, sorted by length of the state name and in alphabetical order where the length is equal:

[
  'Iowa',
  'Ohio',
  'Utah',
  'Idaho',
  'Maine',
  'Texas',
  'Alaska',
  'Hawaii',
  'Kansas',
  'Nevada',
  'Oregon',
  'Alabama',
  'Arizona',
  'Florida',
  'Georgia',
  'Indiana',
  'Montana',
  'Vermont',
  'Wyoming',
  'Arkansas',
  'Colorado',
  'Delaware',
  'Illinois',
  'Kentucky',
  'Maryland',
  'Michigan',
  'Missouri',
  'Nebraska',
  'NewYork',
  'Oklahoma',
  'Virginia',
  'Louisiana',
  'Minnesota',
  'Tennessee',
  'Wisconsin',
  'California',
  'NewJersey',
  'NewMexico',
  'Washington',
  'Connecticut',
  'Mississippi',
  'NorthDakota',
  'Pennsylvania',
  'RhodeIsland',
  'SouthDakota',
  'Massachusetts',
  'NewHampshire',
  'WestVirginia',
  'NorthCarolina',
  'SouthCarolina',
  'DistrictofColumbia'
]
@jeremyleijssen

This comment has been minimized.

Copy link

commented Dec 10, 2015

List of states reversed, with appropriate capitalization
Includes https://en.wikipedia.org/wiki/List_of_U.S._state_abbreviations reversed

$states_initials2full = array(
'Setats Detinu'=>'su',
'Amabala'=>'la',
'Aksala'=>'ka',
'Anozira'=>'za',
'Sasnakra'=>'ra',
'Ainrofilac'=>'ac',
'Odaroloc'=>'oc',
'Tucitcennoc'=>'tc',
'Erawaled'=>'ed',
'Aibmuloc fo tcirtsid'=>'cd',
'Adirolf'=>'lf',
'Aigroeg'=>'ag',
'Iiawah'=>'ih',
'Ohadi'=>'di',
'Sionilli'=>'li',
'Anaidni'=>'ni',
'Awoi'=>'ai',
'Sasnak'=>'sk',
'Ykcutnek'=>'yk',
'Anaisiuol'=>'al',
'Eniam'=>'em',
'Dnalyram'=>'dm',
'Sttesuhcassam'=>'am',
'Nagihcim'=>'im',
'Atosennim'=>'nm',
'Ippississim'=>'sm',
'Iruossim'=>'om',
'Anatnom'=>'tm',
'Aksarben'=>'en',
'Adaven'=>'vn',
'Erihspmah weN'=>'hn',
'Yesrej wen'=>'jn',
'Ocixem wen'=>'mn',
'Kroy wen'=>'yn',
'Anilorac Htron'=>'cn',
'Atokad Htron'=>'dn',
'Oiho'=>'ho',
'Amohalko'=>'ko',
'Nogero'=>'ro',
'Ainavlysnnep'=>'ap', 
'DnalsI edohr'=>'ir', 
'AniloraC htuos'=>'cs', 
'AtokaD htuos'=>'ds', 
'Eessennet'=>'nt', 
'Saxet'=>'xt', 
'Hatu'=>'tu', 
'Tnomrev'=>'tv', 
'Ainigriv'=>'av', 
'Notgnihsaw'=>'aw', 
'Ainigriv Tsew'=>'vw', 
'Nisnocsiw'=>'iw', 
'Gnimoyw'=>'yw', 
'Aomas Nacirema'=>'sa', 
'Maug'=>'ug', 
'Sdnalsi Anairam Nrehtron'=>'pm', 
'Ocir otreup'=>'rp', 
'Sdnalsi Nigriv'=>'iv', 
'Sdnalsi Gniyltuo Ronim S.U.'=>'mu', 
'Aisenorcim fo Setats Detaredef'=>'mf', 
'Sdnalsi Llahsram'=>'hm', 
'Ualap'=>'wp', 
'Sacirema – Secrof Demra S.U.'=>'aa', 
'Eporue – Secrof Demra S.U.'=>'ea', 
'Cificap – Secrof Demra S.U.'=>'pa', 
'Sdnalsi Anairam Nrehtron'=>'mc', 
'Enoz Lanac Amanap'=>'zc', 
'Aksarben'=>'bn', 
'Sdnalsi Enippilihp'=>'ip', 
'Sdnalsi Cificap eht fo Yrotirret Tsurt'=>'tt'   
);
@sebacruz

This comment has been minimized.

Copy link

commented Dec 11, 2015

Improved version of @blackstalk:

$statesCoord = [
    'AL' => ['lat' => 32.6010112, 'lng' => -86.6807365],
    'AK' => ['lat' => 61.3025006, 'lng' => -158.7750198],
    'AZ' => ['lat' => 34.1682185, 'lng' => -111.930907],
    'AR' => ['lat' => 34.7519275, 'lng' => -92.1313784],
    'CA' => ['lat' => 37.2718745, 'lng' => -119.2704153],
    'CO' => ['lat' => 38.9979339, 'lng' => -105.550567],
    'CT' => ['lat' => 41.5187835, 'lng' => -72.757507],
    'DE' => ['lat' => 39.145251, 'lng' => -75.4189206],
    'DC' => ['lat' => 38.8993487, 'lng' => -77.0145666],
    'FL' => ['lat' => 27.9757279, 'lng' => -83.8330166],
    'GA' => ['lat' => 32.6781248, 'lng' => -83.2229757],
    'HI' => ['lat' => 20.46, 'lng' => -157.505],
    'ID' => ['lat' => 45.4945756, 'lng' => -114.1424303],
    'IL' => ['lat' => 39.739318, 'lng' => -89.504139],
    'IN' => ['lat' => 39.7662195, 'lng' => -86.441277],
    'IA' => ['lat' => 41.9383166, 'lng' => -93.389798],
    'KS' => ['lat' => 38.4987789, 'lng' => -98.3200779],
    'KY' => ['lat' => 37.8222935, 'lng' => -85.7682399],
    'LA' => ['lat' => 30.9733766, 'lng' => -91.4299097],
    'ME' => ['lat' => 45.2185133, 'lng' => -69.0148656],
    'MD' => ['lat' => 38.8063524, 'lng' => -77.2684162],
    'MA' => ['lat' => 42.0629398, 'lng' => -71.718067],
    'MI' => ['lat' => 44.9435598, 'lng' => -86.4158049],
    'MN' => ['lat' => 46.4418595, 'lng' => -93.3655146],
    'MS' => ['lat' => 32.5851062, 'lng' => -89.8772196],
    'MO' => ['lat' => 38.3046615, 'lng' => -92.437099],
    'MT' => ['lat' => 46.6797995, 'lng' => -110.044783],
    'NE' => ['lat' => 41.5008195, 'lng' => -99.680902],
    'NV' => ['lat' => 38.502032, 'lng' => -117.0230604],
    'NH' => ['lat' => 44.0012306, 'lng' => -71.5799231],
    'NJ' => ['lat' => 40.1430058, 'lng' => -74.7311156],
    'NM' => ['lat' => 34.1662325, 'lng' => -106.0260685],
    'NY' => ['lat' => 40.7056258, 'lng' => -73.97968],
    'NC' => ['lat' => 35.2145629, 'lng' => -79.8912675],
    'ND' => ['lat' => 47.4678819, 'lng' => -100.3022655],
    'OH' => ['lat' => 40.1903624, 'lng' => -82.6692525],
    'OK' => ['lat' => 35.3097654, 'lng' => -98.7165585],
    'OR' => ['lat' => 44.1419049, 'lng' => -120.5380993],
    'PA' => ['lat' => 40.9945928, 'lng' => -77.6046984],
    'RI' => ['lat' => 41.5827282, 'lng' => -71.5064508],
    'SC' => ['lat' => 33.62505, 'lng' => -80.9470381],
    'SD' => ['lat' => 44.2126995, 'lng' => -100.2471641],
    'TN' => ['lat' => 35.830521, 'lng' => -85.9785989],
    'TX' => ['lat' => 31.1693363, 'lng' => -100.0768425],
    'UT' => ['lat' => 39.4997605, 'lng' => -111.547028],
    'VT' => ['lat' => 43.8717545, 'lng' => -72.4477828],
    'VA' => ['lat' => 38.0033855, 'lng' => -79.4587861],
    'WA' => ['lat' => 38.8993487, 'lng' => -77.0145665],
    'WV' => ['lat' => 38.9201705, 'lng' => -80.1816905],
    'WI' => ['lat' => 44.7862968, 'lng' => -89.8267049],
    'WY' => ['lat' => 43.000325, 'lng' => -107.5545669],
];
@citypaul

This comment has been minimized.

Copy link

commented Dec 11, 2015

Here is a picture of a cat:
cat

@scrubmx

This comment has been minimized.

Copy link

commented Dec 11, 2015

Here is a map to help visualize the states:

us_map_pr

@imaami

This comment has been minimized.

Copy link

commented Dec 13, 2015

C implementation

Information

Here is the list of US state names as a single string containing all the letters sorted into groups by count. Letters which occur only once are sorted by ASCII value. Implementation and test program in ANSI C.

Files

states.h

#ifndef _aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiinnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnooooooooooooooooooooooooooooooooosssssssssssssssssssssssssssssseeeeeeeeeeeeeeeeeeeeeeeeeeeerrrrrrrrrrrrrrrrrrrrrtttttttttttttttttllllllllllllllhhhhhhhhhhhhhMMMMMMMMMNNNNNNNNddddddddkkkkkkkkcccccccggggggguuuuuuuwwwwwwwCCCCCIIIIImmmmmyyyyyAAAAWWWWDDDOOOVVVpppHHKKSSTTbbvvxxFGJLPRUYfz_INCLUDED
#define _aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiinnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnooooooooooooooooooooooooooooooooosssssssssssssssssssssssssssssseeeeeeeeeeeeeeeeeeeeeeeeeeeerrrrrrrrrrrrrrrrrrrrrtttttttttttttttttllllllllllllllhhhhhhhhhhhhhMMMMMMMMMNNNNNNNNddddddddkkkkkkkkcccccccggggggguuuuuuuwwwwwwwCCCCCIIIIImmmmmyyyyyAAAAWWWWDDDOOOVVVpppHHKKSSTTbbvvxxFGJLPRUYfz_INCLUDED

extern const char *aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiinnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnooooooooooooooooooooooooooooooooosssssssssssssssssssssssssssssseeeeeeeeeeeeeeeeeeeeeeeeeeeerrrrrrrrrrrrrrrrrrrrrtttttttttttttttttllllllllllllllhhhhhhhhhhhhhMMMMMMMMMNNNNNNNNddddddddkkkkkkkkcccccccggggggguuuuuuuwwwwwwwCCCCCIIIIImmmmmyyyyyAAAAWWWWDDDOOOVVVpppHHKKSSTTbbvvxxFGJLPRUYfz;

#endif /* _aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiinnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnooooooooooooooooooooooooooooooooosssssssssssssssssssssssssssssseeeeeeeeeeeeeeeeeeeeeeeeeeeerrrrrrrrrrrrrrrrrrrrrtttttttttttttttttllllllllllllllhhhhhhhhhhhhhMMMMMMMMMNNNNNNNNddddddddkkkkkkkkcccccccggggggguuuuuuuwwwwwwwCCCCCIIIIImmmmmyyyyyAAAAWWWWDDDOOOVVVpppHHKKSSTTbbvvxxFGJLPRUYfz_INCLUDED */

states.c

const char *aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiinnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnooooooooooooooooooooooooooooooooosssssssssssssssssssssssssssssseeeeeeeeeeeeeeeeeeeeeeeeeeeerrrrrrrrrrrrrrrrrrrrrtttttttttttttttttllllllllllllllhhhhhhhhhhhhhMMMMMMMMMNNNNNNNNddddddddkkkkkkkkcccccccggggggguuuuuuuwwwwwwwCCCCCIIIIImmmmmyyyyyAAAAWWWWDDDOOOVVVpppHHKKSSTTbbvvxxFGJLPRUYfz = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiinnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnooooooooooooooooooooooooooooooooosssssssssssssssssssssssssssssseeeeeeeeeeeeeeeeeeeeeeeeeeeerrrrrrrrrrrrrrrrrrrrrtttttttttttttttttllllllllllllllhhhhhhhhhhhhhMMMMMMMMMNNNNNNNNddddddddkkkkkkkkcccccccggggggguuuuuuuwwwwwwwCCCCCIIIIImmmmmyyyyyAAAAWWWWDDDOOOVVVpppHHKKSSTTbbvvxxFGJLPRUYfz";

main.c

#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>

#include "states.h"

int main (int argc, char **argv)
{
    int r = puts (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiinnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnooooooooooooooooooooooooooooooooosssssssssssssssssssssssssssssseeeeeeeeeeeeeeeeeeeeeeeeeeeerrrrrrrrrrrrrrrrrrrrrtttttttttttttttttllllllllllllllhhhhhhhhhhhhhMMMMMMMMMNNNNNNNNddddddddkkkkkkkkcccccccggggggguuuuuuuwwwwwwwCCCCCIIIIImmmmmyyyyyAAAAWWWWDDDOOOVVVpppHHKKSSTTbbvvxxFGJLPRUYfz);
    return (r >= 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
@selwynpolit

This comment has been minimized.

Copy link

commented Dec 16, 2015

Let's not forget iso coded states - Useful for Drupal address module. see https://en.wikipedia.org/wiki/ISO_3166-2:US

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

This comment has been minimized.

Copy link

commented Dec 17, 2015

Here is the list in xml

<States>
   <AA>ARMED FORCES AMERICA (EXCEPT CANADA)</AA>
   <AE>ARMED FORCES AFRICA / CANADA / EUROPE / MIDDLE EAST</AE>
   <AK>ALASKA</AK>
   <AL>ALABAMA</AL>
   <AP>ARMED FORCES PACIFIC</AP>
   <AR>ARKANSAS</AR>
   <AS>AMERICAN SAMOA</AS>
   <AZ>ARIZONA</AZ>
   <CA>CALIFORNIA</CA>
   <CO>COLORADO</CO>
   <CT>CONNECTICUT</CT>
   <DC>DISTRICT OF COLUMBIA</DC>
   <DE>DELAWARE</DE>
   <FL>FLORIDA</FL>
   <FM>FEDERATED STATES OF MICRONESIA</FM>
   <GA>GEORGIA</GA>
   <GU>GUAM GU</GU>
   <HI>HAWAII</HI>
   <IA>IOWA</IA>
   <ID>IDAHO</ID>
   <IL>ILLINOIS</IL>
   <IN>INDIANA</IN>
   <KS>KANSAS</KS>
   <KY>KENTUCKY</KY>
   <LA>LOUISIANA</LA>
   <MA>MASSACHUSETTS</MA>
   <MD>MARYLAND</MD>
   <ME>MAINE</ME>
   <MH>MARSHALL ISLANDS</MH>
   <MI>MICHIGAN</MI>
   <MN>MINNESOTA</MN>
   <MO>MISSOURI</MO>
   <MP>NORTHERN MARIANA ISLANDS</MP>
   <MS>MISSISSIPPI</MS>
   <MT>MONTANA</MT>
   <NC>NORTH CAROLINA</NC>
   <ND>NORTH DAKOTA</ND>
   <NE>NEBRASKA</NE>
   <NH>NEW HAMPSHIRE</NH>
   <NJ>NEW JERSEY</NJ>
   <NM>NEW MEXICO</NM>
   <NV>NEVADA</NV>
   <NY>NEW YORK</NY>
   <OH>OHIO</OH>
   <OK>OKLAHOMA</OK>
   <OR>OREGON</OR>
   <PA>PENNSYLVANIA</PA>
   <PR>PUERTO RICO</PR>
   <PW>PALAU</PW>
   <RI>RHODE ISLAND</RI>
   <SC>SOUTH CAROLINA</SC>
   <SD>SOUTH DAKOTA</SD>
   <TN>TENNESSEE</TN>
   <TX>TEXAS</TX>
   <UT>UTAH</UT>
   <VA>VIRGINIA</VA>
   <VI>VIRGIN ISLANDS</VI>
   <VT>VERMONT</VT>
   <WA>WASHINGTON</WA>
   <WI>WISCONSIN</WI>
   <WV>WEST VIRGINIA</WV>
   <WY>WYOMING</WY>
</States>
@aaronbrethorst

This comment has been minimized.

Copy link

commented Dec 17, 2015

Here's a list of US States that will cause a syntax error:

<?php
/* From https://www.usps.com/send/official-abbreviations.htm */
$us_state_abbrevs_names = array(
    AL=>ALABAMA,
    AK=>ALASKA,
    AS=>AMERICAN SAMOA,
    AZ=>ARIZONA,
    AR=>ARKANSAS,
    CA=>CALIFORNIA,
    CO=>COLORADO,
    CT=>CONNECTICUT,
    DE=>DELAWARE,
    DC=>DISTRICT OF COLUMBIA,
    FM=>FEDERATED STATES OF MICRONESIA,
    FL=>FLORIDA,
    GA=>GEORGIA,
    GU=>GUAM GU,
    HI=>HAWAII,
    ID=>IDAHO,
    IL=>ILLINOIS,
    IN=>INDIANA,
    IA=>IOWA,
    KS=>KANSAS,
    KY=>KENTUCKY,
    LA=>LOUISIANA,
    ME=>MAINE,
    MH=>MARSHALL ISLANDS,
    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,
    MP=>NORTHERN MARIANA ISLANDS,
    OH=>OHIO,
    OK=>OKLAHOMA,
    OR=>OREGON,
    PW=>PALAU,
    PA=>PENNSYLVANIA,
    PR=>PUERTO RICO,
    RI=>RHODE ISLAND,
    SC=>SOUTH CAROLINA,
    SD=>SOUTH DAKOTA,
    TN=>TENNESSEE,
    TX=>TEXAS,
    UT=>UTAH,
    VT=>VERMONT,
    VI=>VIRGIN ISLANDS,
    VA=>VIRGINIA,
    WA=>WASHINGTON,
    WV=>WEST VIRGINIA,
    WI=>WISCONSIN,
    WY=>WYOMING,
    AE=>ARMED FORCES AFRICA \ CANADA \ EUROPE \ MIDDLE EAST,
    AA=>ARMED FORCES AMERICA (EXCEPT CANADA),
    AP=>ARMED FORCES PACIFIC
);
?>
@josdotso

This comment has been minimized.

Copy link

commented Dec 17, 2015

Base64 is necessary for usage in LDAP.

QWxhYmFtYQpBbGFza2EKQXJpem9uYQpBcmthbnNhcwpDYWxpZm9ybmlhCkNvbG9yYWRvCkNvbm5lY3RpY3V0CkRlbGF3YXJlCkRpc3RyaWN0IG9mIENvbHVtYmlhCkZsb3JpZGEKR2VvcmdpYQpIYXdhaWkKSWRhaG8KSWxsaW5vaXMKSW5kaWFuYQpJb3dhCkthbnNhcwpLZW50dWNreQpMb3Vpc2lhbmEKTWFpbmUKTWFyeWxhbmQKTWFzc2FjaHVzZXR0cwpNaWNoaWdhbgpNaW5uZXNvdGEKTWlzc2lzc2lwcGkKTWlzc291cmkKTW9udGFuYQpOZWJyYXNrYQpOZXZhZGEKTmV3IEhhbXBzaGlyZQpOZXcgSmVyc2V5Ck5ldyBNZXhpY28KTmV3IFlvcmsKTm9ydGggQ2Fyb2xpbmEKTm9ydGggRGFrb3RhCk9oaW8KT2tsYWhvbWEKT3JlZ29uClBlbm5zeWx2YW5pYQpSaG9kZSBJc2xhbmQKU291dGggQ2Fyb2xpbmEKU291dGggRGFrb3RhClRlbm5lc3NlZQpUZXhhcwpVdGFoClZlcm1vbnQKVmlyZ2luaWEKV2FzaGluZ3RvbgpXZXN0IFZpcmdpbmlhCldpc2NvbnNpbgpXeW9taW5nCkVhc3RlciBFZ2cgSXNsYW5k

@donohoe

This comment has been minimized.

Copy link

commented Dec 17, 2015

List of states that have been visited by both Al Franken and Jacob Harris:

[
  'Iowa',
  'Utah',
  'Idaho',
  'Maine',
  'Kansas',
  'Florida',
  'Georgia',
  'Indiana',
  'Montana',
  'Vermont',
  'Arkansas',
  'Colorado',
  'Delaware',
  'Mexico',
  'Oklahoma',
  'Virginia',
  'Louisiana',
  'Minnesota',
  'Wisconsin',
  'California',
  'NewJersey',
  'Washington',
  'Connecticut',
  'NorthDakota',
  'Pennsylvania',
  'DistrictofColumbia'
]
@aaronbrethorst

This comment has been minimized.

Copy link

commented Dec 17, 2015

Here's a list of US states and territories with typos:

<?php
/* From https://www.usps.com/send/official-abbreviations.htm */
$us_state_abbrevs_names = array(
    'AL'=>'ABALAMA',
    'AK'=>'ALSKA',
    'AS'=>'AMRICAN SAMOA',
    'AZ'=>'ARZONA',
    'AR'=>'ARKANASAS',
    'CA'=>'CALIFRONIA',
    'CO'=>'COROLADO',
    'CT'=>'CONNETICUT',
    'DE'=>'DEALWARE',
    'DC'=>'DISTRICT OF COLOMBIA',
    'FM'=>'FEDERATED STATES OF MACRONESIA',
    'FL'=>'FLORDIA',
    'GA'=>'GORGIA',
    'GU'=>'GOAM',
    'HI'=>'HAIWAII',
    'ID'=>'IDOAH',
    'IL'=>'ILINOIS',
    'IN'=>'INIDIANA',
    'IA'=>'IOWIA',
    'KS'=>'KNASAS',
    'KY'=>'KENITUCKY',
    'LA'=>'LOUSIANA',
    'ME'=>'MAIN',
    'MH'=>'MARSHAL ISLANDS',
    'MD'=>'MARYSLAND',
    'MA'=>'MASSECHUSETTS',
    'MI'=>'MICHAGAN',
    'MN'=>'MINNESODA',
    'MS'=>'MISISIPPI',
    'MO'=>'MISOURI',
    'MT'=>'MOUNTANA',
    'NE'=>'NABRASKA',
    'NV'=>'NAVADA',
    'NH'=>'NEW HAMSHIRE',
    'NJ'=>'NEW JERSY',
    'NM'=>'NEW MEXCIO',
    'NY'=>'NOO YORK',
    'NC'=>'NORTH CARLOINA',
    'ND'=>'NORTH DAKATA',
    'MP'=>'NORTHERN MARINE ISLANDS',
    'OH'=>'OHOI',
    'OK'=>'OKLOHOMA',
    'OR'=>'ORGAN',
    'PW'=>'PAULAU',
    'PA'=>'PENSYLVANIA',
    'PR'=>'PORTO RICO',
    'RI'=>'ROAD ISLAND',
    'SC'=>'SOUTH CARROLINA',
    'SD'=>'SOUTH DOKOTA',
    'TN'=>'TENESSEE',
    'TX'=>'TAXES',
    'UT'=>'UTAHH',
    'VT'=>'VERMOAT',
    'VI'=>'VIRGINIA ISLANDS',
    'VA'=>'VIRGIN',
    'WA'=>'WASSHINGTON',
    'WV'=>'WEST VIRIGINIA',
    'WI'=>'WISCONSEN',
    'WY'=>'WIOMING'
);
?>
@totten

This comment has been minimized.

Copy link

commented Dec 17, 2015

List of states, with uppercase and lowercase abbreviations.

<?php
/* From https://www.usps.com/send/official-abbreviations.htm */
$us_state_abbrevs_names = array(
  'al' => 'ALABAMA',
  'Al' => 'ALABAMA',
  'aL' => 'ALABAMA',
  'AL' => 'ALABAMA',
  'ak' => 'ALASKA',
  'Ak' => 'ALASKA',
  'aK' => 'ALASKA',
  'AK' => 'ALASKA',
  'as' => 'AMERICAN SAMOA',
  'As' => 'AMERICAN SAMOA',
  'aS' => 'AMERICAN SAMOA',
  'AS' => 'AMERICAN SAMOA',
  'az' => 'ARIZONA',
  'Az' => 'ARIZONA',
  'aZ' => 'ARIZONA',
  'AZ' => 'ARIZONA',
  'ar' => 'ARKANSAS',
  'Ar' => 'ARKANSAS',
  'aR' => 'ARKANSAS',
  'AR' => 'ARKANSAS',
  'ca' => 'CALIFORNIA',
  'Ca' => 'CALIFORNIA',
  'cA' => 'CALIFORNIA',
  'CA' => 'CALIFORNIA',
  'co' => 'COLORADO',
  'Co' => 'COLORADO',
  'cO' => 'COLORADO',
  'CO' => 'COLORADO',
  'ct' => 'CONNECTICUT',
  'Ct' => 'CONNECTICUT',
  'cT' => 'CONNECTICUT',
  'CT' => 'CONNECTICUT',
  'de' => 'DELAWARE',
  'De' => 'DELAWARE',
  'dE' => 'DELAWARE',
  'DE' => 'DELAWARE',
  'dc' => 'DISTRICT OF COLUMBIA',
  'Dc' => 'DISTRICT OF COLUMBIA',
  'dC' => 'DISTRICT OF COLUMBIA',
  'DC' => 'DISTRICT OF COLUMBIA',
  'fm' => 'FEDERATED STATES OF MICRONESIA',
  'Fm' => 'FEDERATED STATES OF MICRONESIA',
  'fM' => 'FEDERATED STATES OF MICRONESIA',
  'FM' => 'FEDERATED STATES OF MICRONESIA',
  'fl' => 'FLORIDA',
  'Fl' => 'FLORIDA',
  'fL' => 'FLORIDA',
  'FL' => 'FLORIDA',
  'ga' => 'GEORGIA',
  'Ga' => 'GEORGIA',
  'gA' => 'GEORGIA',
  'GA' => 'GEORGIA',
  'gu' => 'GUAM GU',
  'Gu' => 'GUAM GU',
  'gU' => 'GUAM GU',
  'GU' => 'GUAM GU',
  'hi' => 'HAWAII',
  'Hi' => 'HAWAII',
  'hI' => 'HAWAII',
  'HI' => 'HAWAII',
  'id' => 'IDAHO',
  'Id' => 'IDAHO',
  'iD' => 'IDAHO',
  'ID' => 'IDAHO',
  'il' => 'ILLINOIS',
  'Il' => 'ILLINOIS',
  'iL' => 'ILLINOIS',
  'IL' => 'ILLINOIS',
  'in' => 'INDIANA',
  'In' => 'INDIANA',
  'iN' => 'INDIANA',
  'IN' => 'INDIANA',
  'ia' => 'IOWA',
  'Ia' => 'IOWA',
  'iA' => 'IOWA',
  'IA' => 'IOWA',
  'ks' => 'KANSAS',
  'Ks' => 'KANSAS',
  'kS' => 'KANSAS',
  'KS' => 'KANSAS',
  'ky' => 'KENTUCKY',
  'Ky' => 'KENTUCKY',
  'kY' => 'KENTUCKY',
  'KY' => 'KENTUCKY',
  'la' => 'LOUISIANA',
  'La' => 'LOUISIANA',
  'lA' => 'LOUISIANA',
  'LA' => 'LOUISIANA',
  'me' => 'MAINE',
  'Me' => 'MAINE',
  'mE' => 'MAINE',
  'ME' => 'MAINE',
  'mh' => 'MARSHALL ISLANDS',
  'Mh' => 'MARSHALL ISLANDS',
  'mH' => 'MARSHALL ISLANDS',
  'MH' => 'MARSHALL ISLANDS',
  'md' => 'MARYLAND',
  'Md' => 'MARYLAND',
  'mD' => 'MARYLAND',
  'MD' => 'MARYLAND',
  'ma' => 'MASSACHUSETTS',
  'Ma' => 'MASSACHUSETTS',
  'mA' => 'MASSACHUSETTS',
  'MA' => 'MASSACHUSETTS',
  'mi' => 'MICHIGAN',
  'Mi' => 'MICHIGAN',
  'mI' => 'MICHIGAN',
  'MI' => 'MICHIGAN',
  'mn' => 'MINNESOTA',
  'Mn' => 'MINNESOTA',
  'mN' => 'MINNESOTA',
  'MN' => 'MINNESOTA',
  'ms' => 'MISSISSIPPI',
  'Ms' => 'MISSISSIPPI',
  'mS' => 'MISSISSIPPI',
  'MS' => 'MISSISSIPPI',
  'mo' => 'MISSOURI',
  'Mo' => 'MISSOURI',
  'mO' => 'MISSOURI',
  'MO' => 'MISSOURI',
  'mt' => 'MONTANA',
  'Mt' => 'MONTANA',
  'mT' => 'MONTANA',
  'MT' => 'MONTANA',
  'ne' => 'NEBRASKA',
  'Ne' => 'NEBRASKA',
  'nE' => 'NEBRASKA',
  'NE' => 'NEBRASKA',
  'nv' => 'NEVADA',
  'Nv' => 'NEVADA',
  'nV' => 'NEVADA',
  'NV' => 'NEVADA',
  'nh' => 'NEW HAMPSHIRE',
  'Nh' => 'NEW HAMPSHIRE',
  'nH' => 'NEW HAMPSHIRE',
  'NH' => 'NEW HAMPSHIRE',
  'nj' => 'NEW JERSEY',
  'Nj' => 'NEW JERSEY',
  'nJ' => 'NEW JERSEY',
  'NJ' => 'NEW JERSEY',
  'nm' => 'NEW MEXICO',
  'Nm' => 'NEW MEXICO',
  'nM' => 'NEW MEXICO',
  'NM' => 'NEW MEXICO',
  'ny' => 'NEW YORK',
  'Ny' => 'NEW YORK',
  'nY' => 'NEW YORK',
  'NY' => 'NEW YORK',
  'nc' => 'NORTH CAROLINA',
  'Nc' => 'NORTH CAROLINA',
  'nC' => 'NORTH CAROLINA',
  'NC' => 'NORTH CAROLINA',
  'nd' => 'NORTH DAKOTA',
  'Nd' => 'NORTH DAKOTA',
  'nD' => 'NORTH DAKOTA',
  'ND' => 'NORTH DAKOTA',
  'mp' => 'NORTHERN MARIANA ISLANDS',
  'Mp' => 'NORTHERN MARIANA ISLANDS',
  'mP' => 'NORTHERN MARIANA ISLANDS',
  'MP' => 'NORTHERN MARIANA ISLANDS',
  'oh' => 'OHIO',
  'Oh' => 'OHIO',
  'oH' => 'OHIO',
  'OH' => 'OHIO',
  'ok' => 'OKLAHOMA',
  'Ok' => 'OKLAHOMA',
  'oK' => 'OKLAHOMA',
  'OK' => 'OKLAHOMA',
  'or' => 'OREGON',
  'Or' => 'OREGON',
  'oR' => 'OREGON',
  'OR' => 'OREGON',
  'pw' => 'PALAU',
  'Pw' => 'PALAU',
  'pW' => 'PALAU',
  'PW' => 'PALAU',
  'pa' => 'PENNSYLVANIA',
  'Pa' => 'PENNSYLVANIA',
  'pA' => 'PENNSYLVANIA',
  'PA' => 'PENNSYLVANIA',
  'pr' => 'PUERTO RICO',
  'Pr' => 'PUERTO RICO',
  'pR' => 'PUERTO RICO',
  'PR' => 'PUERTO RICO',
  'ri' => 'RHODE ISLAND',
  'Ri' => 'RHODE ISLAND',
  'rI' => 'RHODE ISLAND',
  'RI' => 'RHODE ISLAND',
  'sc' => 'SOUTH CAROLINA',
  'Sc' => 'SOUTH CAROLINA',
  'sC' => 'SOUTH CAROLINA',
  'SC' => 'SOUTH CAROLINA',
  'sd' => 'SOUTH DAKOTA',
  'Sd' => 'SOUTH DAKOTA',
  'sD' => 'SOUTH DAKOTA',
  'SD' => 'SOUTH DAKOTA',
  'tn' => 'TENNESSEE',
  'Tn' => 'TENNESSEE',
  'tN' => 'TENNESSEE',
  'TN' => 'TENNESSEE',
  'tx' => 'TEXAS',
  'Tx' => 'TEXAS',
  'tX' => 'TEXAS',
  'TX' => 'TEXAS',
  'ut' => 'UTAH',
  'Ut' => 'UTAH',
  'uT' => 'UTAH',
  'UT' => 'UTAH',
  'vt' => 'VERMONT',
  'Vt' => 'VERMONT',
  'vT' => 'VERMONT',
  'VT' => 'VERMONT',
  'vi' => 'VIRGIN ISLANDS',
  'Vi' => 'VIRGIN ISLANDS',
  'vI' => 'VIRGIN ISLANDS',
  'VI' => 'VIRGIN ISLANDS',
  'va' => 'VIRGINIA',
  'Va' => 'VIRGINIA',
  'vA' => 'VIRGINIA',
  'VA' => 'VIRGINIA',
  'wa' => 'WASHINGTON',
  'Wa' => 'WASHINGTON',
  'wA' => 'WASHINGTON',
  'WA' => 'WASHINGTON',
  'wv' => 'WEST VIRGINIA',
  'Wv' => 'WEST VIRGINIA',
  'wV' => 'WEST VIRGINIA',
  'WV' => 'WEST VIRGINIA',
  'wi' => 'WISCONSIN',
  'Wi' => 'WISCONSIN',
  'wI' => 'WISCONSIN',
  'WI' => 'WISCONSIN',
  'wy' => 'WYOMING',
  'Wy' => 'WYOMING',
  'wY' => 'WYOMING',
  'WY' => 'WYOMING',
  'ae' => 'ARMED FORCES AFRICA \ CANADA \ EUROPE \ MIDDLE EAST',
  'Ae' => 'ARMED FORCES AFRICA \ CANADA \ EUROPE \ MIDDLE EAST',
  'aE' => 'ARMED FORCES AFRICA \ CANADA \ EUROPE \ MIDDLE EAST',
  'AE' => 'ARMED FORCES AFRICA \ CANADA \ EUROPE \ MIDDLE EAST',
  'aa' => 'ARMED FORCES AMERICA (EXCEPT CANADA)',
  'Aa' => 'ARMED FORCES AMERICA (EXCEPT CANADA)',
  'aA' => 'ARMED FORCES AMERICA (EXCEPT CANADA)',
  'AA' => 'ARMED FORCES AMERICA (EXCEPT CANADA)',
  'ap' => 'ARMED FORCES PACIFIC',
  'Ap' => 'ARMED FORCES PACIFIC',
  'aP' => 'ARMED FORCES PACIFIC',
  'AP' => 'ARMED FORCES PACIFIC',
);
@joshmanders

This comment has been minimized.

Copy link

commented Dec 17, 2015

Here's a list of states that represent this thread:

$states = array('insanity');
@jblebrun

This comment has been minimized.

Copy link

commented Dec 17, 2015

Internationalization

<?php
/* From https://www.usps.com/send/official-abbreviations.htm */
$us_state_abbrevs_names = array(
    'AB' => 'Alberta', 
    'BC' => 'British Columbia',
    'MB' => 'Manitoba',
    'NB' => 'New Brunswick',
    'NL' => 'Newfoundland and Labrador',
    'NS' => 'Nova Scotia',
    'ON' => 'Ontario',
    'PE' => 'Prince Edward Island',
    'SK' => 'Saskatchewan',
    'QC' => 'Quebec'
);
@dannguyen

This comment has been minimized.

Copy link

commented Dec 17, 2015

My solution only requires 2 files: listofstates.html and listofstatesArray.php, AND it is compatible with standard PHP 5+ and BOTH jQuery 1.x AND 2.x:

listofstates.html

Just open this file in your browser, wait for jQuery to do its magic, then copy paste into a new file called "states_temp.php", then listofstatesArray.php will get that list of 50 states as desired.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>List of United States</title>
  <script src="jquery.js"></script>
</head>
<body>

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


<script>
  $(document).ready(function(){
    var THE_LIST = "<?php $US_STATES=array(";
    UNITED_STATES_H1 = $("html h1");
    for(var stateIndex = 0; stateIndex < 50; stateIndex++){
      var SINGLE_STATE = $(UNITED_STATES_H1[stateIndex]).text();
      if(stateIndex == 49){
        THE_LIST += "'WY: Wyoming'"
      }else{
        THE_LIST += "'" + SINGLE_STATE  + "'";
      }
    }

    THE_LIST += "); $>"
    $("html").text(THE_LIST);
  })
</script>


</body>
</html>

listofstatesArray.php

<?php
$THE_UNITED_STATES  = file_get_contents('states_temp.php');
eval($THE_UNITED_STATES);
?>
@adelevie

This comment has been minimized.

Copy link

commented Dec 17, 2015

Can I get a Ruby Hash of the states? Thanks!

@luke3butler

This comment has been minimized.

Copy link

commented Dec 17, 2015

State Birds

$state_birds = array(
    'Alabama' => 'Yellowhammer',
    'Alaska' => 'Willow Ptarmigan',
    'Arizona' => 'Cactus Wren',
    'Arkansas' => 'Mockingbird',
    'California' => 'California Valley Quail',
    'Colorado' => 'Lark Bunting',
    'Connecticut' => 'Robin',
    'Delaware' => 'Blue Hen Chicken',
    'Florida' => 'Mockingbird',
    'Georgia' => 'Brown Thrasher',
    'Hawaii' => 'Nene',
    'Idaho' => 'Mountain Bluebird',
    'Illinois' => 'Cardinal',
    'Indiana' => 'Cardinal',
    'Iowa' => 'Eastern Goldfinch',
    'Kansas' => 'Western Meadowlark',
    'Kentucky' => 'Cardinal',
    'Louisiana' => 'Eastern Brown Pelican',
    'Maine' => 'Chickadee',
    'Maryland' => 'Baltimore Oriole',
    'Massachusetts' => 'Chickadee',
    'Michigan' => 'Robin',
    'Minnesota' => 'Common Loon',
    'Mississippi' => 'Mockingbird',
    'Missouri' => 'Bluebird',
    'Montana' => 'Western Meadowlark',
    'Nebraska' => 'Western Meadowlark',
    'Nevada' => 'Mountain Bluebird',
    'New Hampshire' => 'Purple Finch',
    'New Jersey' => 'Eastern Goldfinch',
    'New Mexico' => 'Roadrunner',
    'New York' => 'Bluebird',
    'North Carolina' => 'Cardinal',
    'North Dakota' => 'Western Meadowlark',
    'Ohio' => 'Cardinal',
    'Oklahoma' => 'Scissor-tailed Flycatcher',
    'Oregon' => 'Western Meadowlark',
    'Pennsylvania' => 'Ruffed Grouse',
    'Rhode Island' => 'Rhode Island Red',
    'South Carolina' => 'Great Carolina Wren',
    'South Dakota' => 'Ring-necked Pheasant',
    'Tennessee' => 'Mockingbird',
    'Texas' => 'Mockingbird',
    'Utah' => 'Common American Gull',
    'Vermont' => 'Hermit Thrush',
    'Virginia' => 'Cardinal ',
    'Washington' => 'Willow Goldfinch',
    'West Virginia' => 'Cardinal',
    'Wisconsin' => 'Robin',
    'Wyoming' => 'Western Meadowlark'
  );
@sesopenko

This comment has been minimized.

Copy link

commented Dec 17, 2015

Here is a regular expression that matches any US state abbreviation.
/^(?:A[AELKPSZR]|C[AOT]|D[EC]|F[ML]|G[AU]|HI|I[DLNA]|K[SYU]|LA|M[EHDAINSOT]|N[EVHJM]|MP|O[HKR]|P[WAR]|RI|S[CD]|T[NX]|UT|V[TIA]|W[AVIUY])$/

@starhawking

This comment has been minimized.

Copy link

commented Dec 17, 2015

Ported to Python

Creates a tuple of fundamental states of matter sorted alphabetically.

states_of_matter = (
    'Gas',
    'Liquid',
    'Plasma',
    'Solid',
)
@SnidelyWhiplash

This comment has been minimized.

Copy link

commented Dec 17, 2015

Here is an array of commenters on this gist, keyed by the md5 of their username (I've excluded myself because technically at the time of writing I haven't commented yet, and should not be included for accuracy's sake):

<?php

  $an_array_of_commenters_on_this_gist_keyed_by_the_md5_of_their_username = array(
    '8bfb6838c75aaa6ced26fe2bd933c321' => 'Charlex',
    '1691d9969d6e2605fe82d66c263f9082' => 'bnski',
    '668364b9333940b608db5d0588949970' => 'danberlyoung',
    '70e6a5458aca69d7e88511103cc1f2ca' => 'christianc1',
    '27bf94ff84c9c8f02b55bec036cf1157' => 'HiSamn',
    '8a7074a701da6139757a39e455abdda8' => 'nciske',
    '82c1425c28e288c324cd864285c9655f' => 'spedinfargo',
    '4241ead9df3a3f654eda6e988cb85e39' => 'yalamber',
    '029fe225749868c93dd9f0cfd022fe57' => 'morganestes',
    '7ff77d25fde0380e1304dca25c2aebae' => 'Adeelgill',
    '0b2f2f86cae33a92b4768bbf4e3be7ff' => 'imjohnbon',
    '12265c1a64d90e48005ea200efde91bf' => 'brs14ku',
    '874cfe4523588d871051c65a8fbc5475' => 'alanpuccinelli',
    '824d0e880f3573a7ee5faf68fbf84df4' => 'garyhussey',
    'ed37778a6db9294438dcaf160589d12b' => 'blackstalk',
    'f74634912ef62509f8f2a9abaa23a641' => 'jserle',
    '93637ea0321314f457a5739a1063f68d' => 'katart',
    'ea6d3ac5eae38f1e30f2abfa52f92a8b' => 'kazoto',
    'ea6d3ac5eae38f1e30f2abfa52f92a8b' => 'kazoto',
    'f51e41952ae0ca142b1d378cba7a28c7' => 'iDev0urer',
    '19846a96f40329b0dbe604d288fcdbd1' => 'austinkregel',
    'e23067e34b494ffc523bbaa801abfd9a' => 'iautomation',
    '4028e479cbdd7a55d5b877060da450f6' => 'drg809',
    '72156eb340494550593c28f5dab2e5ea' => 'bannostookaylo',
    '2aa965e59403de00fbaf4b38a754ddad' => 'hansondr',
    'bc998d435ac46cc570a54ea155385ea4' => 'salaback',
    '0df4097f91601e6aa6bf49987c305fbb' => 'ranierimachado',
    '3c2d20f7a4ef992beb6b8a9a843aac07' => 'jomo',
    'af1f3437be6bd86bb6d5e2dc3ae03e4e' => 'jeremyleijssen',
    '610776a81cb3fb3776a3b9dabfece6bb' => 'sebacruz',
    '9d453ada25394289d0d5fa50fef8c76f' => 'citypaul',
    'ef1489a86663fb543d272a21824175f3' => 'scrubmx',
    '82703a4ce72c0e3376977edb2bdbe6c7' => 'imaami',
    '130a49bf59697b21329148029a1f31c2' => 'selwynpolit',
    '9e5324aefae14f23306d2a526f5f6dc4' => 'ask5',
    '754b9025fedce62d47d9b5af926fceee' => 'aaronbrethorst',
    '9db4c28a89d8e43415c964e3991fbcca' => 'josdotso',
    'c07cb4541efda1afd095f62bd839ceee' => 'donohoe',
    '754b9025fedce62d47d9b5af926fceee' => 'aaronbrethorst',
    '8c4386c3b68772eb37e4a3d11a7830f6' => 'totten',
    'da5341877cc211acb9a109939793d463' => 'joshmanders',
    'a1db478d5142cf6817a59acbd21f2286' => 'jblebrun',
    '080a3a75716a9f0d75275a0b3dcf56d9' => 'dannguyen',
    '95dd8245595ce333b051e233eca767d1' => 'adelevie',
    '58653f5745697736e59314ae25d01428' => 'luke3butler',
    '5e9f6bf5d0d78836f8c178bdc0f41413' => 'sesopenko',
    '3af14dd8a327ac04858723a86d81e996' => 'starhawkins',
  );

?>
@chandrewz

This comment has been minimized.

Copy link

commented Dec 17, 2015

Using Laravel's str_slug() method for URL friendly slugs.

$states_slug = array(
    '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',
);
@j2willey

This comment has been minimized.

Copy link

commented Dec 17, 2015

'Red', 'BL'=>'Blue',); ?>
@etjossem

This comment has been minimized.

Copy link

commented Dec 17, 2015

Updates @SnidelyWhiplash's data (an array of commenters on this gist, keyed by the md5 of their username) from GitHub API.

Prints result in Ruby Hash form for @adelevie's convenience.

require "http"
require "json"
require "digest"

md5 = Digest::MD5.new
body = HTTP.get("https://api.github.com/gists/2776900/comments?per_page=100").body
comments = JSON.parse(body)
users = Array.new
users_by_md5 = Hash.new
comments.each {|c| users << c["user"]["login"]}
users.each {|u| users_by_md5[Digest::MD5.hexdigest(u)] = u }
puts users_by_md5
{"8bfb6838c75aaa6ced26fe2bd933c321"=>"Charlex", "1691d9969d6e2605fe82d66c263f9082"=>"bnski", "668364b9333940b608db5d0588949970"=>"danberlyoung", "70e6a5458aca69d7e88511103cc1f2ca"=>"christianc1", "27bf94ff84c9c8f02b55bec036cf1157"=>"HiSamn", "8a7074a701da6139757a39e455abdda8"=>"nciske", "82c1425c28e288c324cd864285c9655f"=>"spedinfargo", "4241ead9df3a3f654eda6e988cb85e39"=>"yalamber", "029fe225749868c93dd9f0cfd022fe57"=>"morganestes", "7ff77d25fde0380e1304dca25c2aebae"=>"Adeelgill", "0b2f2f86cae33a92b4768bbf4e3be7ff"=>"imjohnbon", "12265c1a64d90e48005ea200efde91bf"=>"brs14ku", "874cfe4523588d871051c65a8fbc5475"=>"alanpuccinelli", "824d0e880f3573a7ee5faf68fbf84df4"=>"garyhussey", "ed37778a6db9294438dcaf160589d12b"=>"blackstalk", "f74634912ef62509f8f2a9abaa23a641"=>"jserle", "93637ea0321314f457a5739a1063f68d"=>"katart", "ea6d3ac5eae38f1e30f2abfa52f92a8b"=>"kazoto", "f51e41952ae0ca142b1d378cba7a28c7"=>"iDev0urer", "19846a96f40329b0dbe604d288fcdbd1"=>"austinkregel", "e23067e34b494ffc523bbaa801abfd9a"=>"iautomation", "4028e479cbdd7a55d5b877060da450f6"=>"drg809", "72156eb340494550593c28f5dab2e5ea"=>"bannostookaylo", "2aa965e59403de00fbaf4b38a754ddad"=>"hansondr", "bc998d435ac46cc570a54ea155385ea4"=>"salaback", "0df4097f91601e6aa6bf49987c305fbb"=>"ranierimachado", "3c2d20f7a4ef992beb6b8a9a843aac07"=>"jomo", "af1f3437be6bd86bb6d5e2dc3ae03e4e"=>"jeremyleijssen", "610776a81cb3fb3776a3b9dabfece6bb"=>"sebacruz", "9d453ada25394289d0d5fa50fef8c76f"=>"citypaul", "ef1489a86663fb543d272a21824175f3"=>"scrubmx", "82703a4ce72c0e3376977edb2bdbe6c7"=>"imaami", "130a49bf59697b21329148029a1f31c2"=>"selwynpolit", "9e5324aefae14f23306d2a526f5f6dc4"=>"ask5", "754b9025fedce62d47d9b5af926fceee"=>"aaronbrethorst", "9db4c28a89d8e43415c964e3991fbcca"=>"josdotso", "c07cb4541efda1afd095f62bd839ceee"=>"donohoe", "8c4386c3b68772eb37e4a3d11a7830f6"=>"totten", "da5341877cc211acb9a109939793d463"=>"joshmanders", "a1db478d5142cf6817a59acbd21f2286"=>"jblebrun", "080a3a75716a9f0d75275a0b3dcf56d9"=>"dannguyen", "95dd8245595ce333b051e233eca767d1"=>"adelevie", "58653f5745697736e59314ae25d01428"=>"luke3butler", "5e9f6bf5d0d78836f8c178bdc0f41413"=>"sesopenko", "ab779e0d066dfa408849397240b3ecf9"=>"starhawking", "86808106337f34f28ab8292adeccb46c"=>"SnidelyWhiplash", "50e89b88876eb22c9c2f2148091b93a9"=>"chandrewz", "d183b0b1b00dfeccb7ec23cd3dd33c52"=>"j2willey"}
@ron-wolf

This comment has been minimized.

Copy link

commented Dec 17, 2015

Here is a more complete array of the usernames of commenters on this gist (keyed by MD5) that does not produce a syntax error. You’re welcome.

<?php
  $a_more_complete_array_of_the_usernames_of_commenters_on_this_gist_keyed_by_md5_that_does_not_produce_a_syntax_error_you_re_welcome = array(
    '8bfb6838c75aaa6ced26fe2bd933c321' => 'Charlex',
    '1691d9969d6e2605fe82d66c263f9082' => 'bnski',
    '668364b9333940b608db5d0588949970' => 'danberlyoung',
    '70e6a5458aca69d7e88511103cc1f2ca' => 'christianc1',
    '27bf94ff84c9c8f02b55bec036cf1157' => 'HiSamn',
    '8a7074a701da6139757a39e455abdda8' => 'nciske',
    '82c1425c28e288c324cd864285c9655f' => 'spedinfargo',
    '4241ead9df3a3f654eda6e988cb85e39' => 'yalamber',
    '029fe225749868c93dd9f0cfd022fe57' => 'morganestes',
    '7ff77d25fde0380e1304dca25c2aebae' => 'Adeelgill',
    '0b2f2f86cae33a92b4768bbf4e3be7ff' => 'imjohnbon',
    '12265c1a64d90e48005ea200efde91bf' => 'brs14ku',
    '874cfe4523588d871051c65a8fbc5475' => 'alanpuccinelli',
    '824d0e880f3573a7ee5faf68fbf84df4' => 'garyhussey',
    'ed37778a6db9294438dcaf160589d12b' => 'blackstalk',
    'f74634912ef62509f8f2a9abaa23a641' => 'jserle',
    '93637ea0321314f457a5739a1063f68d' => 'katart',
    'ea6d3ac5eae38f1e30f2abfa52f92a8b' => 'kazoto',
    'ea6d3ac5eae38f1e30f2abfa52f92a8b' => 'kazoto',
    'f51e41952ae0ca142b1d378cba7a28c7' => 'iDev0urer',
    '19846a96f40329b0dbe604d288fcdbd1' => 'austinkregel',
    'e23067e34b494ffc523bbaa801abfd9a' => 'iautomation',
    '4028e479cbdd7a55d5b877060da450f6' => 'drg809',
    '72156eb340494550593c28f5dab2e5ea' => 'bannostookaylo',
    '2aa965e59403de00fbaf4b38a754ddad' => 'hansondr',
    'bc998d435ac46cc570a54ea155385ea4' => 'salaback',
    '0df4097f91601e6aa6bf49987c305fbb' => 'ranierimachado',
    '3c2d20f7a4ef992beb6b8a9a843aac07' => 'jomo',
    'af1f3437be6bd86bb6d5e2dc3ae03e4e' => 'jeremyleijssen',
    '610776a81cb3fb3776a3b9dabfece6bb' => 'sebacruz',
    '9d453ada25394289d0d5fa50fef8c76f' => 'citypaul',
    'ef1489a86663fb543d272a21824175f3' => 'scrubmx',
    '82703a4ce72c0e3376977edb2bdbe6c7' => 'imaami',
    '130a49bf59697b21329148029a1f31c2' => 'selwynpolit',
    '9e5324aefae14f23306d2a526f5f6dc4' => 'ask5',
    '754b9025fedce62d47d9b5af926fceee' => 'aaronbrethorst',
    '9db4c28a89d8e43415c964e3991fbcca' => 'josdotso',
    'c07cb4541efda1afd095f62bd839ceee' => 'donohoe',
    '754b9025fedce62d47d9b5af926fceee' => 'aaronbrethorst',
    '8c4386c3b68772eb37e4a3d11a7830f6' => 'totten',
    'da5341877cc211acb9a109939793d463' => 'joshmanders',
    'a1db478d5142cf6817a59acbd21f2286' => 'jblebrun',
    '080a3a75716a9f0d75275a0b3dcf56d9' => 'dannguyen',
    '95dd8245595ce333b051e233eca767d1' => 'adelevie',
    '58653f5745697736e59314ae25d01428' => 'luke3butler',
    '5e9f6bf5d0d78836f8c178bdc0f41413' => 'sesopenko',
    '3af14dd8a327ac04858723a86d81e996' => 'starhawkins',
    '86808106337f34f28ab8292adeccb46c' => 'SnidelyWhiplash'
  );
?>
@manfrin

This comment has been minimized.

Copy link

commented Dec 18, 2015

Here's a handy Ruby snippet for handling states in objects:

in your gemfile:
gem 'state_machine'

in an activerecord model:

state :al do  
  def to_s
    'Alabama'
  end
end

state :ak do
  def to_s
    'Alaska'
  end
end

state :az do
  def to_s
    'Arizona'
  end
end

state :ar do
  def to_s
    'Arkansas'
  end
end

state :ca do
  def to_s
    'California'
  end
end

state :co do
  def to_s
    'Colorado'
  end
end

state :ct do
  def to_s
    'Connecticut'
  end
end

state :de do
  def to_s
    'Delaware'
  end
end

state :dc do
  def to_s
    'District of Columbia'
  end
end

state :fl do
  def to_s
    'Florida'
  end
end

state :ga do
  def to_s
    'Georgia'
  end
end

state :hi do
  def to_s
    'Hawaii'
  end
end

state :id do
  def to_s
    'Idaho'
  end
end

state :il do
  def to_s
    'Illinois'
  end
end

state :in do
  def to_s
    'Indiana'
  end
end

state :ia do
  def to_s
    'Iowa'
  end
end

state :ks do
  def to_s
    'Kansas'
  end
end

state :ky do
  def to_s
    'Kentucky'
  end
end

state :la do
  def to_s
    'Louisiana'
  end
end

state :me do
  def to_s
    'Maine'
  end
end

state :md do
  def to_s
    'Maryland'
  end
end

state :ma do
  def to_s
    'Massachusetts'
  end
end

state :mi do
  def to_s
    'Michigan'
  end
end

state :mn do
  def to_s
    'Minnesota'
  end
end

state :ms do
  def to_s
    'Mississippi'
  end
end

state :mo do
  def to_s
    'Missouri'
  end
end

state :mt do
  def to_s
    'Montana'
  end
end

state :ne do
  def to_s
    'Nebraska'
  end
end

state :nv do
  def to_s
    'Nevada'
  end
end

state :nh do
  def to_s
    'New Hampshire'
  end
end

state :nj do
  def to_s
    'New Jersey'
  end
end

state :nm do
  def to_s
    'New Mexico'
  end
end

state :ny do
  def to_s
    'New York'
  end
end

state :nc do
  def to_s
    'North Carolina'
  end
end

state :nd do
  def to_s
    'North Dakota'
  end
end

state :oh do
  def to_s
    'Ohio'
  end
end

state :ok do
  def to_s
    'Oklahoma'
  end
end

state :or do
  def to_s
    'Oregon'
  end
end

state :pa do
  def to_s
    'Pennsylvania'
  end
end

state :ri do
  def to_s
    'Rhode Island'
  end
end

state :sc do
  def to_s
    'South Carolina'
  end
end

state :sd do
  def to_s
    'South Dakota'
  end
end

state :tn do
  def to_s
    'Tennessee'
  end
end

state :tx do
  def to_s
    'Texas'
  end
end

state :ut do
  def to_s
    'Utah'
  end
end

state :vt do
  def to_s
    'Vermont'
  end
end

state :va do
  def to_s
    'Virginia'
  end
end

state :wa do
  def to_s
    'Washington'
  end
end

state :wv do
  def to_s
    'West Virginia'
  end
end

state :wi do
  def to_s
    'Wisconsin'
  end
end

state :wy do
  def to_s
    'Wyoming'
  end
end

Now, whatever your model's 'state' is, you just call :to_s and it'll return the state string.

For a gem called state machine you'd think it'd already have this functionality, i might submit a pr to patch this missing oversight.

@etjossem

This comment has been minimized.

Copy link

commented Dec 18, 2015

@sesopenko: Here is a regular expression that also matches any US state abbreviation.

/[A-Z]{2}/

This implementation is forward-compatible for new states.

@kierdavis

This comment has been minimized.

Copy link

commented Dec 18, 2015

Here is a useful mapping of Wikipedia page titles relating to the word "state" to short summaries of the concepts described by each page, as outlined by Wikipedia's disambiguation page for the word "state":

<?php

// From: https://en.wikipedia.org/wiki/State

$states = array(
    // Law and politics
    "State (polity)" => "An organized political community living under a single system of government",
    "The Estates" => "A national assembly of the estates",
    "Rechtsstaat" => "The legal state (constitutional state, state subordinated to law) in philosophy of law and as principle of many national constitutions",

    // Medicine
    "Medical state" => "One's current state of health, usually within a hospital setting",

    // Physics and chemistry
    "State" => "A complete description of a system in classical mechanics",
    "Quantum state" => "The state of a quantum mechanical system given by a vector in the underlying Hilbert space",
    "Stationary state" => "An eigenvector of a Hamiltonian",
    "Thermodynamic state" => "A set of physical quantities describing variable properties of a given thermodynamic system",
    "State of matter" => "Solid, liquid or vapour phases of matter; it describes the organization of matter in a phase",
    "Chemical state" => "The electronic, chemical and physical nature of an element",

    // Computing
    "State (computer science)" => "A unique configuration of information in a program or machine",
    "Program state" => "In computer science, a snapshot of the measure of various conditions in the system",
    "State pattern" => "In computer science, a behavioral design pattern",
    "State (printmaking)" => "A unique form of a print, caused by a deliberate change to a matrix",
    "State (software)" => "Animation software for YouTube and social media sites",

    // Mathematics
    "State (controls)" => "A term related to control theory",
    "State (functional analysis)" => "A positive linear functional on an operator algebra",

    // Literature
    "\"The State\" (Larry Niven)" => "A fictional government in the works of Larry Niven",
    "The State (book)" => "A book by German sociologist Franz Oppenheimer",

    // Media
    "The State (album)" => "A music album by Nickelback",
    "The State (TV series)" => "A sketch comedy show on MTV",
    "The States (TV series)" => "A documentary series on the United States",
    "States Records" => "An American record label",
    "The State (newspaper)" => "A daily newspaper in Columbia, South Carolina, US",

    // Magazines
    "State (magazine)" => "An Irish monthly music magazine",
    "State Magazine" => "A monthly magazine published by the U.S. Department of State",

    // Other
    "State (theology)" => "A degree or stage of perfection in the Christian religion",
    "Status constructus" => "A noun form occurring in Semitic languages",
    "State Theatre" => "Several theatres; see https://en.wikipedia.org/wiki/State_Theatre_(disambiguation)"
);

?>
@RWJMurphy

This comment has been minimized.

Copy link

commented Dec 18, 2015

@adelevie, here's a Ruby Hash that specializes in US States:

require 'nokogiri'
require 'open-uri'

class StateHash < Hash
  def [](key)
    return states[key.upcase]
  end

  def []=(key, value)
    raise SecurityError.new("You are not authorized to change state names.")
  end

  def keys
    return states.keys
  end

  def values
    return states.values
  end

  private
  def states
    @states ||= begin
      states = {}
      page = Nokogiri::HTML(open('https://en.wikipedia.org/wiki/List_of_states_and_territories_of_the_United_States'))
      state_table = page.xpath('//th[text()="State"]/ancestor::table')
      keys = state_table.xpath('./tr[position()=1]/th').map { |th| th.text.strip.downcase.gsub(/(\.$|\[.*\]$)/, '') }

      state_table.xpath('./tr[position()>1]').each do |tr|
        state_info = {}
        keys.zip(tr.xpath('./td|th')).each do |key, value|
          state_info[key] = value.text.gsub(/^[^[:alnum:]]/, '')
        end
        abbr = state_info['abbr']
        states[abbr] = state_info
      end

      states
    end
  end
end
[1] pry(main)> states = StateHash.new
=> {}
[2] pry(main)> states['AK']
=> {"state"=>"Alaska",
 "abbr"=>"AK",
 "capital"=>"Juneau",
 "largest city"=>"Anchorage",
 "statehood"=>"January 3, 1959",
 "population\n(2013 est)"=>"735,132",
 "total area in mi2 (km2)"=>"7012172333664880780♠665,384 (1,723,337)",
 "land area in mi2 (km2)"=>"7012147795340527024♠570,641 (1,477,950)",
 "water area in mi2 (km2)"=>"7011245383243537563♠94,743 (245,383)",
 "house seat(s)"=>"1"}
[3] pry(main)> states['wi']
=> {"state"=>"Wisconsin",
 "abbr"=>"WI",
 "capital"=>"Madison",
 "largest city"=>"Milwaukee",
 "statehood"=>"May 29, 1848",
 "population\n(2013 est)"=>"5,742,713",
 "total area in mi2 (km2)"=>"7011169633861274566♠65,496 (169,634)",
 "land area in mi2 (km2)"=>"7011140268576079577♠54,158 (140,269)",
 "water area in mi2 (km2)"=>"7010293678751830999♠11,339 (29,368)",
 "house seat(s)"=>"8"}
[4] pry(main)> states['despair'] = true
SecurityError: You are not authorized to change state names.
@quercy

This comment has been minimized.

Copy link

commented Dec 18, 2015

@Chandrews: here is an array of slugs:

[
    "Orthurethra",
    "Achatinelloidea Gulick",
    "Cochlicopoidea Pilsbry",
    "Partuloidea Pilsbry",
    "Pupilloidea Turton",
    "Sigmurethra",
    "Acavoidea Pilsbry",
    "Achatinoidea Swainson",
    "Aillyoidea Baker",
    "Arionoidea J.E. Gray in Turnton",
    "Athoracophoroidea",
    "Orthalicoidea",
    "Camaenoidea Pilsbry",
    "Clausilioidea Mörch",
    "Dyakioidea Gude & Woodward",
    "Gastrodontoidea Tryon",
    "Helicoidea Rafinesque",
    "Helixarionoidea Bourguignat",
    "Limacoidea Rafinesque",
    "Oleacinoidea H. & A. Adams",
    "Orthalicoidea Albers-Martens",
    "Plectopylidoidea Moellendorf",
    "Polygyroidea Pilsbry",
    "Punctoidea Morse",
    "Rhytidoidea Pilsbry",
    "Sagdidoidera Pilsbry",
    "Staffordioidea Thiele",
    "Streptaxoidea J.E. Gray",
    "Strophocheiloidea Thiele",
    "Parmacelloidea",
    "Zonitoidea Mörch"
]
@okwme

This comment has been minimized.

Copy link

commented Dec 18, 2015

State O' Maine at Hotel New Hampshire:
Statoe O' Maine

@harrisj

This comment has been minimized.

Copy link

commented Dec 18, 2015

Here is a list of states with the letters sorted and counted for your convenience (so, Virginia becomes AGI3NRV because there are 3 Is in it)

{"A4BLM"=>"Alabama",
 "A3KLS"=>"Alaska",
 "A2INORZ"=>"Arizona",
 "A3KNRS2"=>"Arkansas",
 "A2CFI2LNOR"=>"California",
 "ACDLO3R"=>"Colorado",
 "C3EIN2OT2U"=>"Connecticut",
 "A2DE2LRW"=>"Delaware",
 "ABC2DFI3LMO2RST2U"=>"District of Columbia",
 "ADFILOR"=>"Florida",
 "AEG2IOR"=>"Georgia",
 "A2HI2W"=>"Hawaii",
 "ADHIO"=>"Idaho",
 "I3L2NOS"=>"Illinois",
 "A2DI2N2"=>"Indiana",
 "AIOW"=>"Iowa",
 "A2KNS2"=>"Kansas",
 "CEK2NTUY"=>"Kentucky",
 "A2I2LNOSU"=>"Louisiana",
 "AEIMN"=>"Maine",
 "A2DLMNRY"=>"Maryland",
 "A2CEHMS4T2U"=>"Massachusetts",
 "ACGHI2MN"=>"Michigan",
 "AEIMN2OST"=>"Minnesota",
 "I4MP2S4"=>"Mississippi",
 "I2MORS2U"=>"Missouri",
 "A2MN2OT"=>"Montana",
 "A2BEKNRS"=>"Nebraska",
 "A2DENV"=>"Nevada",
 "AE2H2IMNPRSW"=>"New Hampshire",
 "E3JNRSWY"=>"New Jersey",
 "CE2IMNOWX"=>"New Mexico",
 "EKNORWY"=>"New York",
 "A2CHILN2O2R2T"=>"North Carolina",
 "A2DHKNO2RT2"=>"North Dakota",
 "HIO2"=>"Ohio",
 "A2HKLMO2"=>"Oklahoma",
 "EGNO2R"=>"Oregon",
 "A2EILN3PSVY"=>"Pennsylvania",
 "AD2EHILNORS"=>"Rhode Island",
 "A2CHILNO2RSTU"=>"South Carolina",
 "A2DHKO2ST2U"=>"South Dakota",
 "E4N2S2T"=>"Tennessee",
 "AESTX"=>"Texas",
 "AHTU"=>"Utah",
 "EMNORTV"=>"Vermont",
 "AGI3NRV"=>"Virginia",
 "AGHIN2OSTW"=>"Washington",
 "AEGI3NRSTVW"=>"West Virginia",
 "CI2N2OS2W"=>"Wisconsin",
 "GIMNOWY"=>"Wyoming"}
@gboone

This comment has been minimized.

Copy link

commented Dec 18, 2015

@chandrewz's solution but with new-mexico spelled correctly.

$states_slug = array(
    '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',
);
@aendrew

This comment has been minimized.

Copy link

commented Dec 18, 2015

@gboone's solution, but with new-mexico spelled incorrectly again.

$states_slug = array(
    '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',
);
@damontgomery

This comment has been minimized.

Copy link

commented Dec 18, 2015

For those at the bottom of the world that use states and where English is the primary language.

$states = [
  'NSW' => 'New South Wales',
  'QLD' => 'Queensland',
  'SA' => 'South Australia',
  'TAS' => 'Tasmania',
  'VIC' => 'Victoria',
  'WA' => 'Western Australia',
];

note: ordered alphabetically, not by importance.
note: this only supports PHP 5.4+ because F old versions.

And, here is a quokka selfie:
Quokka selfie

@chandrewz

This comment has been minimized.

Copy link

commented Dec 18, 2015

@gboone Oops, I did not see your comment and I had already edited and fixed the errors earlier this morning for the record. But good catch! :)

@Eppie

This comment has been minimized.

Copy link

commented Dec 18, 2015

A regex golf challenge

Match all the states but none of the countries. My score is 387, can you beat it?

@newfurniturey

This comment has been minimized.

Copy link

commented Dec 18, 2015

When you're in a super tight spot and need an array but only have a giant heredoc and think that just using explode() is the poor-man's way out, generate an array as a string and eval() or save it to a file and include it!

$raw_states = <<<DATA
ALABAMA (AL)
ALASKA  (AK)
AMERICAN SAMOA  (AS)
ARIZONA (AZ)
ARKANSAS    (AR)
CALIFORNIA  (CA)
COLORADO    (CO)
CONNECTICUT (CT)
DELAWARE    (DE)
DISTRICT OF COLUMBIA    (DC)
FEDERATED STATES OF MICRONESIA  (FM)
FLORIDA (FL)
GEORGIA (GA)
GUAM GU (GU)
HAWAII  (HI)
IDAHO   (ID)
ILLINOIS    (IL)
INDIANA (IN)
IOWA    (IA)
KANSAS  (KS)
KENTUCKY    (KY)
LOUISIANA   (LA)
MAINE   (ME)
MARSHALL ISLANDS    (MH)
MARYLAND    (MD)
MASSACHUSETTS   (MA)
MICHIGAN    (MI)
MINNESOTA   (MN)
MISSISSIPPI (MS)
MISSOURI    (MO)
MONTANA (MT)
NEBRASKA    (NE)
NEVADA  (NV)
NEW HAMPSHIRE   (NH)
NEW JERSEY  (NJ)
NEW MEXICO  (NM)
NEW YORK    (NY)
NORTH CAROLINA  (NC)
NORTH DAKOTA    (ND)
NORTHERN MARIANA ISLANDS    (MP)
OHIO    (OH)
OKLAHOMA    (OK)
OREGON  (OR)
PALAU   (PW)
PENNSYLVANIA    (PA)
PUERTO RICO (PR)
RHODE ISLAND    (RI)
SOUTH CAROLINA  (SC)
SOUTH DAKOTA    (SD)
TENNESSEE   (TN)
TEXAS   (TX)
UTAH    (UT)
VERMONT (VT)
VIRGIN ISLANDS  (VI)
VIRGINIA    (VA)
WASHINGTON  (WA)
WEST VIRGINIA   (WV)
WISCONSIN   (WI)
WYOMING (WY)
ARMED FORCES AFRICA \ CANADA \ EUROPE \ MIDDLE EAST (AE)
ARMED FORCES AMERICA, EXCEPT CANADA (AA)
ARMED FORCES PACIFIC    (AP)
DATA;

$states_array = '$states = [';
$lines = explode("\r\n", trim($raw_states));
foreach ($lines as $line) {
    list($state, $abbr) = explode("\t", trim($line));

    // format the states and clean up the abbreviation
    $state = str_replace('Of', 'of', ucwords(strtolower($state)));
    $abbr = trim($abbr, "()\r\n");

    // add it to our array
    $states_array .= sprintf('"%s" => "%s",%s',
        $abbr, $state, PHP_EOL
    );
}
$states_array .= '];';

// use the states in the current script:
unset($states);
eval($states_array);
foreach ($states as $abbr => $state) {
    echo $state . ' (' . $abbr . ')<br />';
}

// save the states for later:
unset($states);
file_put_contents('states.php', sprintf('<?php%s%s', PHP_EOL, $states_array));
require_once 'states.php';
foreach ($states as $abbr => $state) {
    echo $state . ' (' . $abbr . ')<br />';
}
@HxxxxxS

This comment has been minimized.

Copy link

commented Dec 23, 2015

Here's a list of states i can name from the top of my head:

  • New York
  • California
  • Florida
  • Rhode Island
  • Ohio
  • Utah
  • Indiana
  • South and North Carolina
  • Texas
  • Hawaii
  • Alaska
  • Colorado
  • Massachusetts
  • Mississippi
  • New Mexico
  • Louisiana
  • Washington
  • Oregon
  • Oklahoma
@clamburger

This comment has been minimized.

Copy link

commented Dec 24, 2015

Here's an array containing the letters in the word 'state':

$letters = array('s', 't', 'a', 't', 'e');

And here's the same array, but without duplicates

$letters = array('s', 't', 'a', 'e');
@ghost

This comment has been minimized.

Copy link

commented Dec 25, 2015

I do believe this is the best comment thread in the history of Github.

@genu

This comment has been minimized.

Copy link

commented Dec 27, 2015

Here is a potato:

screen shot 2015-12-27 at 2 21 46 am

@hxgf

This comment has been minimized.

Copy link

commented Dec 31, 2015

thanks so much for this thread, everybody! it really helped me out on this client project and also made me lol

@BobSanDiego

This comment has been minimized.

Copy link

commented Feb 17, 2016

Here is the state department's top ten karaoke songs:

  1. Achy Breaky Heart – Billy Ray Cyrus
  2. I’ve Got You Babe – Sonny and Cher
  3. Picture – Sheryl Crow and Kid Rock
  4. Baby Got Back – Sir Mix-A-Lot
  5. Ice Ice Baby – Vanilla Ice
  6. Barbie Girl – Aqua
  7. My Heart Will Go On – Celine Dion
  8. Margaritaville – Jimmy Buffet
  9. Boyfriend – Justin Bieber
  10. Friday – Rebecca Black

I downloaded it from some email server I found.

@robertholf

This comment has been minimized.

Copy link

commented Mar 21, 2016

As a Laravel 5 Seeder:

    // Empty Table
    DB::table('data_location_state')->delete();

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

This comment has been minimized.

Copy link

commented Apr 11, 2016

For my needs, I have to retype a list of countries with their ISO code. Here it is:

$countries = array
(
    'AF' => 'Afghanistan',
    'AX' => 'Aland Islands',
    'AL' => 'Albania',
    'DZ' => 'Algeria',
    'AS' => 'American Samoa',
    'AD' => 'Andorra',
    'AO' => 'Angola',
    'AI' => 'Anguilla',
    'AQ' => 'Antarctica',
    'AG' => 'Antigua And Barbuda',
    'AR' => 'Argentina',
    'AM' => 'Armenia',
    'AW' => 'Aruba',
    'AU' => 'Australia',
    'AT' => 'Austria',
    'AZ' => 'Azerbaijan',
    'BS' => 'Bahamas',
    'BH' => 'Bahrain',
    'BD' => 'Bangladesh',
    'BB' => 'Barbados',
    'BY' => 'Belarus',
    'BE' => 'Belgium',
    'BZ' => 'Belize',
    'BJ' => 'Benin',
    'BM' => 'Bermuda',
    'BT' => 'Bhutan',
    'BO' => 'Bolivia',
    'BA' => 'Bosnia And Herzegovina',
    'BW' => 'Botswana',
    'BV' => 'Bouvet Island',
    'BR' => 'Brazil',
    'IO' => 'British Indian Ocean Territory',
    'BN' => 'Brunei Darussalam',
    'BG' => 'Bulgaria',
    'BF' => 'Burkina Faso',
    'BI' => 'Burundi',
    'KH' => 'Cambodia',
    'CM' => 'Cameroon',
    'CA' => 'Canada',
    'CV' => 'Cape Verde',
    'KY' => 'Cayman Islands',
    'CF' => 'Central African Republic',
    'TD' => 'Chad',
    'CL' => 'Chile',
    'CN' => 'China',
    'CX' => 'Christmas Island',
    'CC' => 'Cocos (Keeling) Islands',
    'CO' => 'Colombia',
    'KM' => 'Comoros',
    'CG' => 'Congo',
    'CD' => 'Congo, Democratic Republic',
    'CK' => 'Cook Islands',
    'CR' => 'Costa Rica',
    'CI' => 'Cote D\'Ivoire',
    'HR' => 'Croatia',
    'CU' => 'Cuba',
    'CY' => 'Cyprus',
    'CZ' => 'Czech Republic',
    'DK' => 'Denmark',
    'DJ' => 'Djibouti',
    'DM' => 'Dominica',
    'DO' => 'Dominican Republic',
    'EC' => 'Ecuador',
    'EG' => 'Egypt',
    'SV' => 'El Salvador',
    'GQ' => 'Equatorial Guinea',
    'ER' => 'Eritrea',
    'EE' => 'Estonia',
    'ET' => 'Ethiopia',
    'FK' => 'Falkland Islands (Malvinas)',
    'FO' => 'Faroe Islands',
    'FJ' => 'Fiji',
    'FI' => 'Finland',
    'FR' => 'France',
    'GF' => 'French Guiana',
    'PF' => 'French Polynesia',
    'TF' => 'French Southern Territories',
    'GA' => 'Gabon',
    'GM' => 'Gambia',
    'GE' => 'Georgia',
    'DE' => 'Germany',
    'GH' => 'Ghana',
    'GI' => 'Gibraltar',
    'GR' => 'Greece',
    'GL' => 'Greenland',
    'GD' => 'Grenada',
    'GP' => 'Guadeloupe',
    'GU' => 'Guam',
    'GT' => 'Guatemala',
    'GG' => 'Guernsey',
    'GN' => 'Guinea',
    'GW' => 'Guinea-Bissau',
    'GY' => 'Guyana',
    'HT' => 'Haiti',
    'HM' => 'Heard Island & Mcdonald Islands',
    'VA' => 'Holy See (Vatican City State)',
    'HN' => 'Honduras',
    'HK' => 'Hong Kong',
    'HU' => 'Hungary',
    'IS' => 'Iceland',
    'IN' => 'India',
    'ID' => 'Indonesia',
    'IR' => 'Iran, Islamic Republic Of',
    'IQ' => 'Iraq',
    'IE' => 'Ireland',
    'IM' => 'Isle Of Man',
    'IL' => 'Israel',
    'IT' => 'Italy',
    'JM' => 'Jamaica',
    'JP' => 'Japan',
    'JE' => 'Jersey',
    'JO' => 'Jordan',
    'KZ' => 'Kazakhstan',
    'KE' => 'Kenya',
    'KI' => 'Kiribati',
    'KR' => 'Korea',
    'KW' => 'Kuwait',
    'KG' => 'Kyrgyzstan',
    'LA' => 'Lao People\'s Democratic Republic',
    'LV' => 'Latvia',
    'LB' => 'Lebanon',
    'LS' => 'Lesotho',
    'LR' => 'Liberia',
    'LY' => 'Libyan Arab Jamahiriya',
    'LI' => 'Liechtenstein',
    'LT' => 'Lithuania',
    'LU' => 'Luxembourg',
    'MO' => 'Macao',
    'MK' => 'Macedonia',
    'MG' => 'Madagascar',
    'MW' => 'Malawi',
    'MY' => 'Malaysia',
    'MV' => 'Maldives',
    'ML' => 'Mali',
    'MT' => 'Malta',
    'MH' => 'Marshall Islands',
    'MQ' => 'Martinique',
    'MR' => 'Mauritania',
    'MU' => 'Mauritius',
    'YT' => 'Mayotte',
    'MX' => 'Mexico',
    'FM' => 'Micronesia, Federated States Of',
    'MD' => 'Moldova',
    'MC' => 'Monaco',
    'MN' => 'Mongolia',
    'ME' => 'Montenegro',
    'MS' => 'Montserrat',
    'MA' => 'Morocco',
    'MZ' => 'Mozambique',
    'MM' => 'Myanmar',
    'NA' => 'Namibia',
    'NR' => 'Nauru',
    'NP' => 'Nepal',
    'NL' => 'Netherlands',
    'AN' => 'Netherlands Antilles',
    'NC' => 'New Caledonia',
    'NZ' => 'New Zealand',
    'NI' => 'Nicaragua',
    'NE' => 'Niger',
    'NG' => 'Nigeria',
    'NU' => 'Niue',
    'NF' => 'Norfolk Island',
    'MP' => 'Northern Mariana Islands',
    'NO' => 'Norway',
    'OM' => 'Oman',
    'PK' => 'Pakistan',
    'PW' => 'Palau',
    'PS' => 'Palestinian Territory, Occupied',
    'PA' => 'Panama',
    'PG' => 'Papua New Guinea',
    'PY' => 'Paraguay',
    'PE' => 'Peru',
    'PH' => 'Philippines',
    'PN' => 'Pitcairn',
    'PL' => 'Poland',
    'PT' => 'Portugal',
    'PR' => 'Puerto Rico',
    'QA' => 'Qatar',
    'RE' => 'Reunion',
    'RO' => 'Romania',
    'RU' => 'Russian Federation',
    'RW' => 'Rwanda',
    'BL' => 'Saint Barthelemy',
    'SH' => 'Saint Helena',
    'KN' => 'Saint Kitts And Nevis',
    'LC' => 'Saint Lucia',
    'MF' => 'Saint Martin',
    'PM' => 'Saint Pierre And Miquelon',
    'VC' => 'Saint Vincent And Grenadines',
    'WS' => 'Samoa',
    'SM' => 'San Marino',
    'ST' => 'Sao Tome And Principe',
    'SA' => 'Saudi Arabia',
    'SN' => 'Senegal',
    'RS' => 'Serbia',
    'SC' => 'Seychelles',
    'SL' => 'Sierra Leone',
    'SG' => 'Singapore',
    'SK' => 'Slovakia',
    'SI' => 'Slovenia',
    'SB' => 'Solomon Islands',
    'SO' => 'Somalia',
    'ZA' => 'South Africa',
    'GS' => 'South Georgia And Sandwich Isl.',
    'ES' => 'Spain',
    'LK' => 'Sri Lanka',
    'SD' => 'Sudan',
    'SR' => 'Suriname',
    'SJ' => 'Svalbard And Jan Mayen',
    'SZ' => 'Swaziland',
    'SE' => 'Sweden',
    'CH' => 'Switzerland',
    'SY' => 'Syrian Arab Republic',
    'TW' => 'Taiwan',
    'TJ' => 'Tajikistan',
    'TZ' => 'Tanzania',
    'TH' => 'Thailand',
    'TL' => 'Timor-Leste',
    'TG' => 'Togo',
    'TK' => 'Tokelau',
    'TO' => 'Tonga',
    'TT' => 'Trinidad And Tobago',
    'TN' => 'Tunisia',
    'TR' => 'Turkey',
    'TM' => 'Turkmenistan',
    'TC' => 'Turks And Caicos Islands',
    'TV' => 'Tuvalu',
    'UG' => 'Uganda',
    'UA' => 'Ukraine',
    'AE' => 'United Arab Emirates',
    'GB' => 'United Kingdom',
    'US' => 'United States',
    'UM' => 'United States Outlying Islands',
    'UY' => 'Uruguay',
    'UZ' => 'Uzbekistan',
    'VU' => 'Vanuatu',
    'VE' => 'Venezuela',
    'VN' => 'Viet Nam',
    'VG' => 'Virgin Islands, British',
    'VI' => 'Virgin Islands, U.S.',
    'WF' => 'Wallis And Futuna',
    'EH' => 'Western Sahara',
    'YE' => 'Yemen',
    'ZM' => 'Zambia',
    'ZW' => 'Zimbabwe',
);
@xem

This comment has been minimized.

Copy link

commented Apr 11, 2016

Here's the list of all the states and capitols:
https://www.youtube.com/watch?v=sNUDDaEOvuY

@ValentinH

This comment has been minimized.

Copy link

commented Apr 11, 2016

Here's a video about the evolution of this thread: https://www.youtube.com/watch?v=dQw4w9WgXcQ

@SomeKittens

This comment has been minimized.

Copy link

commented Apr 11, 2016

Here's a npm module that returns the content of the first file in this gist: https://www.npmjs.com/package/states-github

EDIT: Is it "a npm module" or "an npm module"?

@zeg-io

This comment has been minimized.

Copy link

commented Apr 11, 2016

Here is a JSON object array with various ways of writing out "npm module" and their grammatical correctness:

[
  {
    version: 'an npm module', 
    isCorrect: false, 
    why: 'While the majority of people would use this, it is grammatically incorrect because it doesn't start with a vowel'
  },
  {
    version: 'a npm module', 
    isCorrect: true, 
    why: 'While you will sound like a fool, this is, in fact, proper grammatically because "N" is a consonant.'
  },
  {
    version: 'a Node Package Manager module', 
    isCorrect: true, 
    why: 'Because the letter "N" is a consonant, so you use "a" and not "an."'
  },
  {
    version: 'an Node Package Manager module', 
    isCorrect: false, 
    why: 'I just explained this, are you dense?'
  }
]
@CrowderSoup

This comment has been minimized.

Copy link

commented Apr 12, 2016

Actually, @zeg-io if the word makes a vowel sound it's okay to use "an". In this case, " npm" makes and "e" sound, so "an" is okay to use.

@zeg-io

This comment has been minimized.

Copy link

commented Apr 12, 2016

@CrowderSoup According to a linguist friend of mine, it is in fact, not. I actually researched it prior to posting... go figure.

Also, for the violation of the spirit of this list by not providing a list, here is a list of punishments that might be leveled against you, you may pick one:

{
  'Sweep the sunshine off the sidewalks',
  'You're a ghost. You cannot post anymore, Go act like a ghost',
  'Carry a small tree with you wherever you go to replace the oxygen you stole from everyone else',
  'Get into a metal trash can and every time someone posts, you pop out and post the current time. Then, most importantly, you crawl back into the can after.',
  'The Eagle Scout: Go out into the woods and build yourself a nest.  No, farther...farther...',
  'Perform 1,000 smiley-frownies. (Smile, then frown, that's 1)',
  'Go out and hug a tree. It needs it, and you probably do too.',
  'Post a list of things that contributes the the brilliance that is this thread.'
}
@basarat

This comment has been minimized.

Copy link

commented Apr 13, 2016

Here it is HackLang
image

<?hh
/* From https://www.usps.com/send/official-abbreviations.htm */
$us_state_abbrevs_names = array(
    'AL'=>'ALABAMA',
    'AK'=>'ALASKA',
    'AS'=>'AMERICAN SAMOA',
    'AZ'=>'ARIZONA',
    'AR'=>'ARKANSAS',
    'CA'=>'CALIFORNIA',
    'CO'=>'COLORADO',
    'CT'=>'CONNECTICUT',
    'DE'=>'DELAWARE',
    'DC'=>'DISTRICT OF COLUMBIA',
    'FM'=>'FEDERATED STATES OF MICRONESIA',
    'FL'=>'FLORIDA',
    'GA'=>'GEORGIA',
    'GU'=>'GUAM GU',
    'HI'=>'HAWAII',
    'ID'=>'IDAHO',
    'IL'=>'ILLINOIS',
    'IN'=>'INDIANA',
    'IA'=>'IOWA',
    'KS'=>'KANSAS',
    'KY'=>'KENTUCKY',
    'LA'=>'LOUISIANA',
    'ME'=>'MAINE',
    'MH'=>'MARSHALL ISLANDS',
    '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',
    'MP'=>'NORTHERN MARIANA ISLANDS',
    'OH'=>'OHIO',
    'OK'=>'OKLAHOMA',
    'OR'=>'OREGON',
    'PW'=>'PALAU',
    'PA'=>'PENNSYLVANIA',
    'PR'=>'PUERTO RICO',
    'RI'=>'RHODE ISLAND',
    'SC'=>'SOUTH CAROLINA',
    'SD'=>'SOUTH DAKOTA',
    'TN'=>'TENNESSEE',
    'TX'=>'TEXAS',
    'UT'=>'UTAH',
    'VT'=>'VERMONT',
    'VI'=>'VIRGIN ISLANDS',
    'VA'=>'VIRGINIA',
    'WA'=>'WASHINGTON',
    'WV'=>'WEST VIRGINIA',
    'WI'=>'WISCONSIN',
    'WY'=>'WYOMING',
    'AE'=>'ARMED FORCES AFRICA \ CANADA \ EUROPE \ MIDDLE EAST',
    'AA'=>'ARMED FORCES AMERICA (EXCEPT CANADA)',
    'AP'=>'ARMED FORCES PACIFIC'
);

Please stop using PHP 🌹

@lancebutler2

This comment has been minimized.

Copy link

commented May 3, 2016

$statesWithAtLeastOneFBSFootballTeamThatHasAnOfficialNicknameNotEndingInS = [
    'Alabama' => ['Alabama Crimson Tide'],
    'California' => ['Stanford Cardinal'],
    'Illinois' => ['Illinois Fighting Illini'],
    'Indiana' => ['Notre Dame Fighting Irish'],
    'Louisiana' => ['Tulane Green Wave'],
    'Maryland' => ['Navy Midshipmen'],
    'Massachusetts' => ['UMass Minutemen'],
    'Nevada' => ['Nevada Wolf Pack'],
    'New York' => ['Syracuse Orange'],
    'North Carolina' => ['NC State Wolfpack'],
    'Oklahoma' => ['Tulsa Golden Hurricane'],
    'Texas' => ['North Texas Mean Green'],
    'West Virginia' => ['Marshall Thundering Herd'],
];
@dlwebdev

This comment has been minimized.

Copy link

commented May 17, 2016

List of states feeling the bern:

$feelingBern = array( "AK", "CO", "DA", "HI", "ID", "IN", "KS", "ME", "MI", "MN", "NE", "NH", "OK", "RI", "UT", "VT", "WA", "WI", "WV", "WY" );

@jacobmischka

This comment has been minimized.

Copy link

commented May 20, 2016

@zeg-io So you're saying "a hour" is correct as well? Sorry but I'm pretty certain your linguist friend is either wrong or made up.

@spencersiu

This comment has been minimized.

Copy link

commented May 27, 2016

Sometimes you need this list in a database table...

CREATE TABLE state
(
state_id int primary key auto_increment,
abbr varchar(2),
name varchar(255)
);

INSERT INTO state (abbr,name) VALUES ('AL','ALABAMA');
INSERT INTO state (abbr,name) VALUES ('AK','ALASKA');
INSERT INTO state (abbr,name) VALUES ('AS','AMERICAN SAMOA');
INSERT INTO state (abbr,name) VALUES ('AZ','ARIZONA');
INSERT INTO state (abbr,name) VALUES ('AR','ARKANSAS');
INSERT INTO state (abbr,name) VALUES ('CA','CALIFORNIA');
INSERT INTO state (abbr,name) VALUES ('CO','COLORADO');
INSERT INTO state (abbr,name) VALUES ('CT','CONNECTICUT');
INSERT INTO state (abbr,name) VALUES ('DE','DELAWARE');
INSERT INTO state (abbr,name) VALUES ('DC','DISTRICT OF COLUMBIA');
INSERT INTO state (abbr,name) VALUES ('FM','FEDERATED STATES OF MICRONESIA');
INSERT INTO state (abbr,name) VALUES ('FL','FLORIDA');
INSERT INTO state (abbr,name) VALUES ('GA','GEORGIA');
INSERT INTO state (abbr,name) VALUES ('GU','GUAM GU');
INSERT INTO state (abbr,name) VALUES ('HI','HAWAII');
INSERT INTO state (abbr,name) VALUES ('ID','IDAHO');
INSERT INTO state (abbr,name) VALUES ('IL','ILLINOIS');
INSERT INTO state (abbr,name) VALUES ('IN','INDIANA');
INSERT INTO state (abbr,name) VALUES ('IA','IOWA');
INSERT INTO state (abbr,name) VALUES ('KS','KANSAS');
INSERT INTO state (abbr,name) VALUES ('KY','KENTUCKY');
INSERT INTO state (abbr,name) VALUES ('LA','LOUISIANA');
INSERT INTO state (abbr,name) VALUES ('ME','MAINE');
INSERT INTO state (abbr,name) VALUES ('MH','MARSHALL ISLANDS');
INSERT INTO state (abbr,name) VALUES ('MD','MARYLAND');
INSERT INTO state (abbr,name) VALUES ('MA','MASSACHUSETTS');
INSERT INTO state (abbr,name) VALUES ('MI','MICHIGAN');
INSERT INTO state (abbr,name) VALUES ('MN','MINNESOTA');
INSERT INTO state (abbr,name) VALUES ('MS','MISSISSIPPI');
INSERT INTO state (abbr,name) VALUES ('MO','MISSOURI');
INSERT INTO state (abbr,name) VALUES ('MT','MONTANA');
INSERT INTO state (abbr,name) VALUES ('NE','NEBRASKA');
INSERT INTO state (abbr,name) VALUES ('NV','NEVADA');
INSERT INTO state (abbr,name) VALUES ('NH','NEW HAMPSHIRE');
INSERT INTO state (abbr,name) VALUES ('NJ','NEW JERSEY');
INSERT INTO state (abbr,name) VALUES ('NM','NEW MEXICO');
INSERT INTO state (abbr,name) VALUES ('NY','NEW YORK');
INSERT INTO state (abbr,name) VALUES ('NC','NORTH CAROLINA');
INSERT INTO state (abbr,name) VALUES ('ND','NORTH DAKOTA');
INSERT INTO state (abbr,name) VALUES ('MP','NORTHERN MARIANA ISLANDS');
INSERT INTO state (abbr,name) VALUES ('OH','OHIO');
INSERT INTO state (abbr,name) VALUES ('OK','OKLAHOMA');
INSERT INTO state (abbr,name) VALUES ('OR','OREGON');
INSERT INTO state (abbr,name) VALUES ('PW','PALAU');
INSERT INTO state (abbr,name) VALUES ('PA','PENNSYLVANIA');
INSERT INTO state (abbr,name) VALUES ('PR','PUERTO RICO');
INSERT INTO state (abbr,name) VALUES ('RI','RHODE ISLAND');
INSERT INTO state (abbr,name) VALUES ('SC','SOUTH CAROLINA');
INSERT INTO state (abbr,name) VALUES ('SD','SOUTH DAKOTA');
INSERT INTO state (abbr,name) VALUES ('TN','TENNESSEE');
INSERT INTO state (abbr,name) VALUES ('TX','TEXAS');
INSERT INTO state (abbr,name) VALUES ('UT','UTAH');
INSERT INTO state (abbr,name) VALUES ('VT','VERMONT');
INSERT INTO state (abbr,name) VALUES ('VI','VIRGIN ISLANDS');
INSERT INTO state (abbr,name) VALUES ('VA','VIRGINIA');
INSERT INTO state (abbr,name) VALUES ('WA','WASHINGTON');
INSERT INTO state (abbr,name) VALUES ('WV','WEST VIRGINIA');
INSERT INTO state (abbr,name) VALUES ('WI','WISCONSIN');
INSERT INTO state (abbr,name) VALUES ('WY','WYOMING');
INSERT INTO state (abbr,name) VALUES ('AE','ARMED FORCES AFRICA \ CANADA \ EUROPE \ MIDDLE EAST');
INSERT INTO state (abbr,name) VALUES ('AA','ARMED FORCES AMERICA (EXCEPT CANADA)');
INSERT INTO state (abbr,name) VALUES ('AP','ARMED FORCES PACIFIC');

@apysais

This comment has been minimized.

Copy link

commented Jun 15, 2016

Alabama:Alabama
Alaska:Alaska
Arizona:Arizona
Arkansas:Arkansas
California:California
Colorado:Colorado
Connecticut:Connecticut
Delaware:Delaware
DistrictofColumbia:DistrictofColumbia
Florida:Florida
Georgia:Georgia
Hawaii:Hawaii
Idaho:Idaho
Illinois:Illinois
Indiana:Indiana
Iowa:Iowa
Kansas:Kansas
Kentucky:Kentucky
Louisiana:Louisiana
Maine:Maine
Maryland:Maryland
Massachusetts:Massachusetts
Michigan:Michigan
Minnesota:Minnesota
Mississippi:Mississippi
Missouri:Missouri
Montana:Montana
Nebraska:Nebraska
Nevada:Nevada
NewHampshire:NewHampshire
NewJersey:NewJersey
NewMexico:NewMexico
NewYork:NewYork
NorthCarolina:NorthCarolina
NorthDakota:NorthDakota
Ohio:Ohio
Oklahoma:Oklahoma
Oregon:Oregon
Pennsylvania:Pennsylvania
RhodeIsland:RhodeIsland
SouthCarolina:SouthCarolina
SouthDakota:SouthDakota
Tennessee:Tennessee
Texas:Texas
Utah:Utah
Vermont:Vermont
Virginia:Virginia
Washington:Washington
WestVirginia:WestVirginia
Wisconsin:Wisconsin
Wyoming:Wyoming

@apysais

This comment has been minimized.

Copy link

commented Jul 29, 2016

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

@vincentjflorio

This comment has been minimized.

Copy link

commented Aug 23, 2016

Here's my paying it forward, in return for taking one of the above...

It's basically a lookup table for each state (and DC) and which state (or DC) they touch / are contiguous with.

$touching_states = array(

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

This comment has been minimized.

Copy link

commented Sep 13, 2016

Here's a list of 2 qubit quantum states

// Using enumeration: 00 , 01 , 10 , 11
$states = [
      'Bell' => [1,0,0,1],
      'EPR' => [0,11,0],
      'P' => [0,11,1],
      'Flat' => [1,1,1,1]
];
@mikevolmar

This comment has been minimized.

Copy link

commented Oct 28, 2016

Here is the states array all on one line

$states = array('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');

@jackel414

This comment has been minimized.

Copy link

commented Feb 12, 2017

Not to beat a dead horse, but below is the original array (with capitalization preserved) just reversed. Didn't see that in the list and needed it.

    $us_state_abbrevs_names = array(
        'ALABAMA'=>'AL',
        'ALASKA'=>'AK',
        'AMERICAN SAMOA' => 'AS',
        'ARIZONA'=>'AZ',
        'ARKANSAS'=>'AR',
        'CALIFORNIA'=>'CA',
        'COLORADO'=>'CO',
        'CONNECTICUT'=>'CT',
        'DELAWARE'=>'DE',
        'DISTRICT OF COLUMBIA' => 'DC',
        'FEDERATED STATES OF MICRONESIA' => 'FM',
        'FLORIDA'=>'FL',
        'GEORGIA'=>'GA',
        'GUAM GU' => 'GU',
        'HAWAII'=>'HI',
        'IDAHO'=>'ID',
        'ILLINOIS'=>'IL',
        'INDIANA'=>'IN',
        'IOWA'=>'IA',
        'KANSAS'=>'KS',
        'KENTUCKY'=>'KY',
        'LOUISIANA'=>'LA',
        'MAINE'=>'ME',
        'MARSHALL ISLANDS' => 'MH',
        'MARYLAND'=>'MD',
        'MASSACHUSETTS'=>'MA',
        'MICHIGAN'=>'MI',
        'MINNESOTA'=>'MN',
        'MISSISSIPPI'=>'MS',
        'MISSOURI'=>'MO',
        'MONTANA'=>'MT',
        'NEBRASKA'=>'NE',
        'NEVADA'=>'NV',
        'NEW HAMPSHIRE'=>'NH',
        'NEW JERSEY'=>'NJ',
        'NEW MEXICO'=>'NM',
        'NEW YORK'=>'NY',
        'NORTH CAROLINA'=>'NC',
        'NORTH DAKOTA'=>'ND',
        'NORTHERN MARIANA ISLANDS' => 'MP',
        'OHIO'=>'OH',
        'OKLAHOMA'=>'OK',
        'OREGON'=>'OR',
        'PALAU' => 'PW',
        'PENNSYLVANIA'=>'PA',
        'PUERTO RICO' => 'PR',
        'RHODE ISLAND'=>'RI',
        'SOUTH CAROLINA'=>'SC',
        'SOUTH DAKOTA'=>'SD',
        'TENNESSEE'=>'TN',
        'TEXAS'=>'TX',
        'UTAH'=>'UT',
        'VERMONT'=>'VT',
        'VIRGIN ISLANDS' => 'VI',
        'VIRGINIA'=>'VA',
        'WASHINGTON'=>'WA',
        'WEST VIRGINIA'=>'WV',
        'WISCONSIN'=>'WI',
        'WYOMING'=>'WY',
        'ARMED FORCES AFRICA \ CANADA \ EUROPE \ MIDDLE EAST' => 'AE',
        'ARMED FORCES AMERICA (EXCEPT CANADA)' => 'AA',
        'ARMED FORCES PACIFIC' => 'AP',
    );

@owldesign

This comment has been minimized.

Copy link

commented Feb 16, 2017

Adding Twig array. Craft CMS

{% set states = {
        'AL': 'Alabama',
        'AK': 'Alaska',
        'AS': 'American Samoa',
        'AZ': 'Arizona',
        'AR': 'Arkansas',
        'CA': 'California',
        'CO': 'Colorado',
        'CT': 'Connecticut',
        'DE': 'Delaware',
        'DC': 'District of Columbia',
        'FM': 'Federated States of Micronesia',
        'FL': 'Florida',
        'GA': 'Georgia',
        'GU': 'Guam',
        'HI': 'Hawaii',
        'ID': 'Idaho',
        'IL': 'Illinois',
        'IN'=>'Indiana',
        'IA': 'Iowa',
        'KS': 'Kansas',
        'KY': 'Kentucky',
        'LA': 'Louisiana',
        'ME': 'Maine',
        'MH': 'Marshall Islands',
        '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',
        'MP': 'Northern Mariana Islands',
        'OH': 'Ohio',
        'OK': 'Oklahoma',
        'OR': 'Oregon',
        'PW': 'Palau',
        'PA': 'Pennsylvania',
        'PR': 'Puerto Rico',
        'RI': 'Rhode Island',
        'SC': 'South Carolina',
        'SD': 'South Dakota',
        'TN': 'Tennessee',
        'TX': 'Texas',
        'UT': 'Utah',
        'VT': 'Vermont',
        'VI': 'Virgin Islands',
        'VA': 'Virginia',
        'WA': 'Washington',
        'WV': 'West Virginia',
        'WI': 'Wisconsin',
        'WY': 'Wyoming',
        'AE': 'Armed Forces Europe, the Middle East, and Canada',
        'AP': 'Armed Forces Pacific',
        'AA': 'Armed Forces Americas',
    } %}
@pstinnett

This comment has been minimized.

Copy link

commented Feb 23, 2017

@owldesign You're missing Indiana in that list.

@caleywoods

This comment has been minimized.

Copy link

commented May 26, 2017

Can we get this "as a service"? Calling /some/cool/url should return a randomly formatted array / json object / xml based on the responses of those who left replies. If you're feeling extra skippy weight the likelihood of each authors response so that XML is shown least often (like never).

@michardy

This comment has been minimized.

Copy link

commented Jul 12, 2017

The Federated States of Micronesia are an independent country.

@adaedra

This comment has been minimized.

Copy link

commented Jul 21, 2017

@tysonlist

This comment has been minimized.

Copy link

commented Aug 15, 2017

i needed an associative array...

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

This comment has been minimized.

Copy link

commented Sep 5, 2017

less is more...

array()

@Ayesh

This comment has been minimized.

Copy link

commented Oct 3, 2017

avon-7-x-3-overlap-apex-bike-store-a63

@josepgv

This comment has been minimized.

Copy link

commented Oct 3, 2017

Here is nothing:

@judgej

This comment has been minimized.

@marcuse

This comment has been minimized.

Copy link

commented Oct 4, 2017

Here is a bf program that outputs the state list as csv:

>++++++[<++++++++++>-]<+++++.+++++++++++.>+++[<---------->-]<--.>++[<++++++++++>
-]<+.>++++[<++++++++++>-]<+++.-----------.+.-.++++++++++++.------------.>+++++++
+[<---------->-]<-------.>+++++[<++++++++++>-]<+++++.++++++++++.>+++[<----------
>-]<-.>++[<++++++++++>-]<+.>++++[<++++++++++>-]<+++.-----------.++++++++++++++++
++.--------.----------.>++++++++[<---------->-]<-------.>+++++[<++++++++++>-]<++
+++.>++[<++++++++++>-]<+++++.>++++[<---------->-]<------.>++[<++++++++++>-]<+.>+
+++[<++++++++++>-]<+++++++++.---------.+++++++++++++++++.-----------.-.---------
----.>++++++++[<---------->-]<-------.>+++++[<++++++++++>-]<+++++.++++++++++++++
+++.>+++[<---------->-]<--------.>++[<++++++++++>-]<+.>++++[<++++++++++>-]<+++++
++++.-------.----------.+++++++++++++.+++++.------------------.+++++++++++++++++
+.>++++++++++[<---------->-]<-----.>+++++[<++++++++++>-]<+++++++.--.>++[<-------
--->-]<-.>++[<++++++++++>-]<+++.>+++[<++++++++++>-]<.+++++++++++.---.---.+++++++
++.+++.----.-----.--------.>++++++++[<---------->-]<-------.>+++++[<++++++++++>-
]<+++++++.++++++++++++.>+++[<---------->-]<-----.>++[<++++++++++>-]<+++.>++++[<+
+++++++++>-]<++++.---.+++.+++.-----------------.+++.+++++++++++.>++++++++++[<---
------->-]<-.>+++++[<++++++++++>-]<+++++++.+++++++++++++++++.>++++[<---------->-
]<.>++[<++++++++++>-]<+++.>++++[<++++++++++>-]<++++.-..---------.--.++++++++++++
+++++.-----------.------.++++++++++++++++++.-.>++++++++++[<---------->-]<------.
>+++++[<++++++++++>-]<++++++++.+.>++[<---------->-]<-----.>++[<++++++++++>-]<+++
+.>+++[<++++++++++>-]<+++.+++++++.-----------.>++[<++++++++++>-]<++.>++[<-------
--->-]<--.+++++++++++++++++.-------------.>+++++++++[<---------->-]<-.>+++++[<++
++++++++>-]<++++++++.-.>++[<---------->-]<---.>++[<++++++++++>-]<++++.>+++[<++++
++++++>-]<+++++++.++++++++++.+.--.---------.------.+++++++++++++++++.>++++++++[<
---------->-]<----.>+++++++[<++++++++++>-]<+++++++++.---------.>+++++++[<-------
--->-]<.>+++[<++++++++++>-]<+++++.>++++[<++++++++++>-]<++++.---.+++++++++.------
--.-----------.+++++++.--------.>++++++++[<---------->-]<-------.>++++++[<++++++
++++>-]<.++++++.>+++[<---------->-]<--.>++[<++++++++++>-]<++++++.>+++[<+++++++++
+>-]<++++++++.+++.+++.---------.-----.---.>++++++++[<---------->-]<-------.>++++
++[<++++++++++>-]<+.------.>++[<---------->-]<-.>++[<++++++++++>-]<+++++++.>+++[
<++++++++++>-]<.++++++++++.+++.-----------.++.--------.>++++++++[<---------->-]<
-------.>++++++[<++++++++++>-]<++.+.>++[<---------->-]<---------.>++[<++++++++++
>-]<++++++++.>++[<++++++++++>-]<+++++.>++[<++++++++++>-]<++.>++[<---------->-]<-
-.++++++++..>+++++++++[<---------->-]<-----.>++++++[<++++++++++>-]<+++.-----.>++
[<---------->-]<----.>++[<++++++++++>-]<+++++++++.>++[<++++++++++>-]<+++++++.---
.+++++++.+++++++.>++++++++++[<---------->-]<-.>++++++[<++++++++++>-]<+++.+++.>++
+[<---------->-]<--.>++[<++++++++++>-]<+++++++++.>+++[<++++++++++>-]<+++++..---.
+++++.+.------.++++++++++.>++++++++++[<---------->-]<-----.>++++++[<++++++++++>-
]<+++.+++++.>+++[<---------->-]<----.>++[<++++++++++>-]<+++++++++.>+++[<++++++++
++>-]<+++++++.----------.+++++.--------.+++++++++++++.-------------.>++++++++[<-
--------->-]<-------.>++++++[<++++++++++>-]<+++.--------.>++[<---------->-]<-.>+
+[<++++++++++>-]<+++++++++.>+++[<++++++++++>-]<++++++++.++++++++.>++[<----------
>-]<--.>++++++++[<---------->-]<-------.>++++++[<++++++++++>-]<+++++.++++++++.>+
++[<---------->-]<---------.>+++[<++++++++++>-]<+.>++[<++++++++++>-]<++.++++++++
+++++.+++++.------------------.++++++++++++++++++.>++++++++++[<---------->-]<---
--.>++++++[<++++++++++>-]<+++++.++++++++++++++.>++++[<---------->-]<-----.>+++[<
++++++++++>-]<+.>++[<++++++++++>-]<++++++.+++++++++.++++++.+.------------------.
++++++++.++++++++++++++.>+++++++++++[<---------->-]<-.>++++++[<++++++++++>-]<+++
+++.-----------.>++[<---------->-]<-.>+++[<++++++++++>-]<++.>+++[<++++++++++>-]<
+++++.++++++.------------.++++++++++.----------.--------.+++++++++++++.---------
----.>++++++++[<---------->-]<-------.>++++++[<++++++++++>-]<+++++++.--------.>+
+[<---------->-]<-----.>+++[<++++++++++>-]<+++.>++[<++++++++++>-]<.++++++++.++++
+.---------.>+++++++++[<---------->-]<-.>++++++[<++++++++++>-]<+++++++.---------
.>++[<---------->-]<----.>+++[<++++++++++>-]<+++.>++[<++++++++++>-]<.+++++++++++
++++++.+++++++.-------------.-----------.+++++++++++++.----------.>+++++++++[<--
-------->-]<.>++++++[<++++++++++>-]<+++++++.------------.>++[<---------->-]<-.>+
++[<++++++++++>-]<+++.>++[<++++++++++>-]<.++++++++++++++++++..------------------
.++.+++++.+++++++++++++.--.--------------.+++++++++++++++..-.>++++++++++[<------
---->-]<-----.>++++++[<++++++++++>-]<+++++++.----.>++[<---------->-]<---------.>
+++[<++++++++++>-]<+++.>++[<++++++++++>-]<++++++++.------.+++++.+.--.------.++++
+++++++++.>++++++++++[<---------->-]<.>++++++[<++++++++++>-]<+++++++.+.>+++[<---
------->-]<----.>+++[<++++++++++>-]<+++.>++[<++++++++++>-]<++++++++.+++++..-----
----.++++++++++++++.----.+++++.-------------------.>++++++++[<---------->-]<----
---.>++++++[<++++++++++>-]<+++++++.++++++.>+++[<---------->-]<---------.>+++[<++
++++++++>-]<+++.>++[<++++++++++>-]<++++++++.++++++++++..----------.++++++++++..-
---------.+++++++..-------.>+++++++++[<---------->-]<-----.>++++++[<++++++++++>-
]<+++++++.++.>+++[<---------->-]<-----.>+++[<++++++++++>-]<+++.>++[<++++++++++>-
]<++++++++.++++++++++..----.++++++.---.---------.>+++++++++[<---------->-]<-----
.>++++++[<++++++++++>-]<+++++++.+++++++.>++++[<---------->-]<.>+++[<++++++++++>-
]<+++.>+++[<++++++++++>-]<++++.-.++++++.-------------------.+++++++++++++.------
-------.>++++++++[<---------->-]<-------.>++++++[<++++++++++>-]<++++++++.-------
--.>++[<---------->-]<-----.>+++[<++++++++++>-]<++++.>++[<++++++++++>-]<+++.---.
++++++++++++++++.-----------------.++++++++++++++++++.--------.----------.>+++++
+++[<---------->-]<-------.>++++++[<++++++++++>-]<++++++++.++++++++.>++++[<-----
----->-]<--.>+++[<++++++++++>-]<++++.>++[<++++++++++>-]<+++.+++++++++++++++++.>+
+[<---------->-]<-.+++.---.>++++++++[<---------->-]<-------.>++++++[<++++++++++>
-]<++++++++.------.>++[<---------->-]<--------.>+++[<++++++++++>-]<++++.>++[<+++
+++++++>-]<+++.++++++++++++++++++.>++++++++[<---------->-]<-------.>++++[<++++++
++++>-]<.>++[<++++++++++>-]<+++++.++++++++++++.+++.+++.-----------.+.+++++++++.-
------------.>+++++++++[<---------->-]<-.>++++++[<++++++++++>-]<++++++++.----.>+
++[<---------->-]<.>+++[<++++++++++>-]<++++.>++[<++++++++++>-]<+++.+++++++++++++
+++++.>++++++++[<---------->-]<-------.>++++[<++++++++++>-]<++.>++[<++++++++++>-
]<+++++++.+++++++++++++.+.--------------.>++[<++++++++++>-]<.>+++++++++++[<-----
----->-]<-.>++++++[<++++++++++>-]<++++++++.-.>+++[<---------->-]<---.>+++[<+++++
+++++>-]<++++.>++[<++++++++++>-]<+++.++++++++++++++++++.>++++++++[<---------->-]
<-------.>++++[<++++++++++>-]<+++++.>++[<++++++++++>-]<++++.+++++++++++++++++++.
---------------.------.++++++++++++.>++++++++++[<---------->-]<-.>++++++[<++++++
++++>-]<++++++++.+++++++++++.>++++[<---------->-]<-----.>+++[<++++++++++>-]<++++
.>++[<++++++++++>-]<+++.++++++++++++++++++.>++++++++[<---------->-]<-------.>+++
++[<++++++++++>-]<+++++++.>++[<++++++++++>-]<++.+++.-------.>+++++++++[<--------
-->-]<-------.>++++++[<++++++++++>-]<++++++++.-----------.>++[<---------->-]<---
.>+++[<++++++++++>-]<++++.>+++[<++++++++++>-]<+++.+++.++.------------.>+++++++[<
---------->-]<--.>+++[<++++++++++>-]<+++++.>+++[<++++++++++>-]<.++++++++++++++++
+.---.---.---.+++++.-------------.>++++++++[<---------->-]<-------.>++++++[<++++
++++++>-]<++++++++.----------.>++[<---------->-]<----.>+++[<++++++++++>-]<++++.>
+++[<++++++++++>-]<+++.+++.++.------------.>+++++++[<---------->-]<--.>+++[<++++
++++++>-]<++++++.>++[<++++++++++>-]<+++++++++.++++++++++.++++.+++++.------------
-------.>++++++++[<---------->-]<-------.>++++++[<++++++++++>-]<+++++++++.------
-.>++[<---------->-]<--------.>+++[<++++++++++>-]<+++++.>++[<++++++++++>-]<+++++
.+.++++++.>++++++++++[<---------->-]<-.>++++++[<++++++++++>-]<+++++++++.----.>++
+[<---------->-]<-.>+++[<++++++++++>-]<+++++.>++[<++++++++++>-]<++++++++.+.-----
------.+++++++.+++++++.--.------------.>++++++++[<---------->-]<-------.>++++++[
<++++++++++>-]<+++++++++.+++.>+++[<---------->-]<--------.>+++[<++++++++++>-]<++
+++.>+++[<++++++++++>-]<+++++.-------------.++.++++++++.-.>++++++++++[<---------
->-]<.>+++++++[<++++++++++>-]<.---------------.>++[<---------->-]<-.>+++[<++++++
++++>-]<++++++.>++[<++++++++++>-]<+.+++++++++..+++++.++++++.-------------.++++++
++++.>++[<---------->-]<-.+++++++++++++.-----.--------.>++++++++[<---------->-]<
-------.>+++++++[<++++++++++>-]<++.---------.>++[<---------->-]<---------.>+++[<
++++++++++>-]<++++++++.>++[<++++++++++>-]<++.+++++++.-----------.+.>++++++[<----
------>-]<---------.>++++[<++++++++++>-]<+.>++++[<++++++++++>-]<++.-------.-----
------.+++++++++++++.----------.>+++++++++[<---------->-]<.>+++++++[<++++++++++>
-]<+++.----------------.>++[<---------->-]<---.>+++[<++++++++++>-]<+++++++++.>++
[<++++++++++>-]<++++++++.++++++.-.------------.>+++++++[<---------->-]<--.>+++[<
++++++++++>-]<+++++.>+++[<++++++++++>-]<.+++++++++++++++++.---.---.---.+++++.---
----------.>++++++++[<---------->-]<-------.>+++++++[<++++++++++>-]<+++.--------
-------.>++[<---------->-]<----.>+++[<++++++++++>-]<+++++++++.>++[<++++++++++>-]
<++++++++.++++++.-.------------.>+++++++[<---------->-]<--.>+++[<++++++++++>-]<+
+++++.>++[<++++++++++>-]<+++++++++.++++++++++.++++.+++++.-------------------.>++
++++++[<---------->-]<-------.>+++++++[<++++++++++>-]<++++.------.>+++[<--------
-->-]<----.>++++[<++++++++++>-]<.+++++++++++++++++.+++++++++..---------.++++++++
++++++..--------------..>+++++++++[<---------->-]<-.>+++++++[<++++++++++>-]<++++
.++++.>++++[<---------->-]<----.>++++[<++++++++++>-]<.+++++++++++++++++.++++++++
+++++++++++.>++[<---------->-]<---.++++++++++++++++++.>++++++++++[<---------->-]
<-----.>+++++++[<++++++++++>-]<+++++.-.>++++[<---------->-]<.>++++[<++++++++++>-
]<+.>+++[<++++++++++>-]<+.-------------------.+++++++.>+++++++++[<---------->-]<
----.>+++++++[<++++++++++>-]<++++++.--.>++++[<---------->-]<.>++++[<++++++++++>-
]<++.+++++++++++++++.+++++++++++++.-----.++.-.++++++.>++++++++++[<---------->-]<
------.>+++++++[<++++++++++>-]<++++++.>++[<---------->-]<-.>++[<---------->-]<-.
>++++[<++++++++++>-]<++.+++++++++++++++++++.+++++++++.-----------.++.+++++.-----
.--------.>++++++++[<---------->-]<-------.>+++++++[<++++++++++>-]<+++++++.>++[<
---------->-]<--.>++[<---------->-]<-.>++++[<++++++++++>-]<+++.++++++++++.++++++
++++++++++++.-----------.+.+++++.-------.+++++++++++++.-----.-.>++++++++++[<----
------>-]<.>+++++++[<++++++++++>-]<+++++++.-.>++++[<---------->-]<--.>++++[<++++
++++++>-]<+++.++++++++++++++.++++++++++++++.+.>++++++++[<---------->-]<----.>+++
++[<++++++++++>-]<++++.+++++++++++++++++++.+++++++++.-----------.++.+++++.-----.
--------.>++++++++[<---------->-]<-------.>+++++++[<++++++++++>-]<+++++++.------
--------.>++[<---------->-]<---------.>++++[<++++++++++>-]<+++.+++++++++++++++++
+.++++++++++.----------------.++++++++++++.-.+++++.----------.+++++.>++++++++++[
<---------->-]<.>+++++++[<++++++++++>-]<+++++++.++.>++++[<---------->-]<-----.>+
+++[<++++++++++>-]<+++.>+++[<++++++++++>-]<++++.----------.--.----.+++++.-------
.>+++++++++[<---------->-]<---.
@amazingmikeyc

This comment has been minimized.

Copy link

commented Oct 4, 2017

here's a list of US States spelled incorrectly

`<?php

$value = [
'awkenssaw',
'new yorke',
'allaskca',
'hawayee',
'vurginyuh',
'east vruginyuh',
'louise and anna',
'mrs zippy',
'newmeg's sicko',
'now mexico',
'not mexico',
'florryda'
]
`

@fdbeirao

This comment has been minimized.

Copy link

commented Oct 17, 2017

Here's to you guys:

image

@technotarek

This comment has been minimized.

Copy link

commented Jan 26, 2018

U.S. Indian Territories and Indian Tribal Organizations (ITOs)

<?php

    $indian_territories = array(
            'acoma-canoncito-laguna' => 'Acoma, Canoncito and Laguna',
            'cherokee-nation-of-oklahoma' => 'Cherokee Nation of Oklahoma',
            'cheyenne-river-sioux-tribe' => 'Cheyenne River Sioux Tribe',
            'chickasaw-nation' => 'Chickasaw Nation',
            'choctaw-nation-of-oklahoma' => 'Choctaw Nation of Oklahoma',
            'citizen-potawatomi-nation' => 'Citizen Potawatomi Nation',
            'eastern-band-of-cherokee-indians' => 'Eastern Band of Cherokee Indians',
            'eastern-shoshone' => 'Eastern Shoshone',
            'eight-northern-indian-pueblo-council' => 'Eight Northern Indian Pueblo Council',
            'five-sandoval-indian-pueblos' => 'Five Sandoval Indian Pueblos',
            'indian-township-passamaquoddy-reservation' => 'Indian Township Passamaquoddy Reservation',
            'inter-tribal-council-of-arizona' => 'Inter Tribal Council of Arizona',
            'inter-tribal-council-of-nevada' => 'Inter Tribal Council of Nevada',
            'inter-tribal-council-of-oklahoma' => 'Inter Tribal Council of Oklahoma',
            'mississippi-band-of-choctaw-indians' => 'Mississippi Band of Choctaw Indians',
            'muscogee-creek-nation' => 'Muscogee Creek Nation',
            'navajo-nation' => 'Navajo Nation',
            'northern-arapaho' => 'Northern Arapaho',
            'omaha-sioux' => 'Omaha Sioux',
            'osage-nation' => 'Osage Nation',
            'otoe-missouria-tribe' => 'Otoe-Missouria Tribe',
            'pleasant-point-passamaquoddy-reservation' => 'Pleasant Point Passamaquoddy Reservation',
            'pueblo-of-isleta' => 'Pueblo of Isleta',
            'pueblo-of-san-felipe' => 'Pueblo of San Felipe',
            'pueblo-of-zuni' => 'Pueblo of Zuni',
            'rosebud-sioux-tribe' => 'Rosebud Sioux Tribe',
            'santee-sioux-tribe' => 'Santee Sioux Tribe',
            'santo-domingo-tribe' => 'Santo Domingo Tribe',
            'seneca-nation' => 'Seneca Nation',
            'standing-rock-sioux-tribe