Abbreviate State Switch

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

0 Comments

You must be logged in to post a comment.