Created
August 11, 2023 18:31
-
-
Save JustSteveKing/2416b987d273620b31a18ca41302396d to your computer and use it in GitHub Desktop.
US States as a PHP Enum
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
namespace App\Enums; | |
enum State: string | |
{ | |
case ALABAMA = 'AL'; | |
case ALASKA = 'AK'; | |
case ARIZONA = 'AZ'; | |
case ARKANSAS = 'AR'; | |
case CALIFORNIA = 'CA'; | |
case COLORADO = 'CO'; | |
case CONNECTICUT = 'CT'; | |
case DELAWARE = 'DE'; | |
case FLORIDA = 'FL'; | |
case GEORGIA = 'GA'; | |
case HAWAII = 'HI'; | |
case IDAHO = 'ID'; | |
case ILLINOIS = 'IL'; | |
case INDIANA = 'IN'; | |
case IOWA = 'IA'; | |
case KANSAS = 'KS'; | |
case KENTUCKY = 'KY'; | |
case LOUISIANA = 'LA'; | |
case MAINE = 'ME'; | |
case MARYLAND = 'MD'; | |
case MASSACHUSETTS = 'MA'; | |
case MICHIGAN = 'MI'; | |
case MINNESOTA = 'MN'; | |
case MISSISSIPPI = 'MS'; | |
case MISSOURI = 'MO'; | |
case MONTANA = 'MT'; | |
case NEBRASKA = 'NE'; | |
case NEVADA = 'NV'; | |
case NEW_HAMPSHIRE = 'NH'; | |
case NEW_JERSEY = 'NJ'; | |
case NEW_MEXICO = 'NM'; | |
case NEW_YORK = 'NY'; | |
case NORTH_CAROLINA = 'NC'; | |
case NORTH_DAKOTA = 'ND'; | |
case OHIO = 'OH'; | |
case OKLAHOMA = 'OK'; | |
case OREGON = 'OR'; | |
case PENNSYLVANIA = 'PA'; | |
case RHODE_ISLAND = 'RI'; | |
case SOUTH_CAROLINA = 'SC'; | |
case SOUTH_DAKOTA = 'SD'; | |
case TENNESSEE = 'TN'; | |
case TEXAS = 'TX'; | |
case UTAH = 'UT'; | |
case VERMONT = 'VT'; | |
case VIRGINIA = 'VA'; | |
case WASHINGTON = 'WA'; | |
case WEST_VIRGINIA = 'WV'; | |
case WISCONSIN = 'WI'; | |
case WYOMING = 'WY'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment