Last active
September 28, 2024 01:26
-
-
Save ricardobarantini/5665214 to your computer and use it in GitHub Desktop.
Array com nome e siglas de estados Brasileiros para select do Codeigniter
This file contains 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
$estadosBrasileiros = array( | |
'AC'=>'Acre', | |
'AL'=>'Alagoas', | |
'AP'=>'Amapá', | |
'AM'=>'Amazonas', | |
'BA'=>'Bahia', | |
'CE'=>'Ceará', | |
'DF'=>'Distrito Federal', | |
'ES'=>'Espírito Santo', | |
'GO'=>'Goiás', | |
'MA'=>'Maranhão', | |
'MT'=>'Mato Grosso', | |
'MS'=>'Mato Grosso do Sul', | |
'MG'=>'Minas Gerais', | |
'PA'=>'Pará', | |
'PB'=>'Paraíba', | |
'PR'=>'Paraná', | |
'PE'=>'Pernambuco', | |
'PI'=>'Piauí', | |
'RJ'=>'Rio de Janeiro', | |
'RN'=>'Rio Grande do Norte', | |
'RS'=>'Rio Grande do Sul', | |
'RO'=>'Rondônia', | |
'RR'=>'Roraima', | |
'SC'=>'Santa Catarina', | |
'SP'=>'São Paulo', | |
'SE'=>'Sergipe', | |
'TO'=>'Tocantins' | |
); |
Enum em PHP:
enum BrazilianStatesEnum: int
{
case AC = 12;
case AL = 27;
case AP = 16;
case AM = 13;
case BA = 29;
case CE = 23;
case DF = 53;
case ES = 32;
case GO = 52;
case MA = 21;
case MT = 51;
case MS = 50;
case MG = 31;
case PA = 15;
case PB = 25;
case PR = 41;
case PE = 26;
case PI = 22;
case RJ = 33;
case RN = 24;
case RS = 43;
case RO = 11;
case RR = 14;
case SC = 42;
case SP = 35;
case SE = 28;
case TO = 17;
public function getName(): string
{
return match($this) {
static::AC => 'Acre',
static::AL => 'Alagoas',
static::AP => 'Amapá',
static::AM => 'Amazonas',
static::BA => 'Bahia',
static::CE => 'Ceará',
static::DF => 'Distrito Federal',
static::ES => 'Espírito Santo',
static::GO => 'Goiás',
static::MA => 'Maranhão',
static::MT => 'Mato Grosso',
static::MS => 'Mato Grosso do Sul',
static::MG => 'Minas Gerais',
static::PA => 'Pará',
static::PB => 'Paraíba',
static::PR => 'Paraná',
static::PE => 'Pernambuco',
static::PI => 'Piauí',
static::RJ => 'Rio de Janeiro',
static::RN => 'Rio Grande do Norte',
static::RS => 'Rio Grande do Sul',
static::RO => 'Rondônia',
static::RR => 'Roraima',
static::SC => 'Santa Catarina',
static::SP => 'São Paulo',
static::SE => 'Sergipe',
static::TO => 'Tocantins',
};
}
public function getRegion(): string
{
return match($this) {
static::AC => 'Norte',
static::AL => 'Nordeste',
static::AP => 'Norte',
static::AM => 'Norte',
static::BA => 'Nordeste',
static::CE => 'Nordeste',
static::DF => 'Centro-Oeste',
static::ES => 'Sudeste',
static::GO => 'Centro-Oeste',
static::MA => 'Nordeste',
static::MT => 'Centro-Oeste',
static::MS => 'Centro-Oeste',
static::MG => 'Sudeste',
static::PA => 'Norte',
static::PB => 'Nordeste',
static::PR => 'Sul',
static::PE => 'Nordeste',
static::PI => 'Nordeste',
static::RJ => 'Sudeste',
static::RN => 'Nordeste',
static::RS => 'Sul',
static::RO => 'Norte',
static::RR => 'Norte',
static::SC => 'Sul',
static::SP => 'Sudeste',
static::SE => 'Nordeste',
static::TO => 'Norte',
};
}
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Enum em TypeScript com Códigos das UF's