Province
in package
This class provides a list of provinces in Thailand and Laos.
Tags
Table of Contents
- all() : array<string|int, mixed>
- Get a list of all provinces.
- countries() : array<string|int, mixed>
- Get a list of countries with installed provinces.
- get() : string
- Get the name of a province based on its ISO code and language.
- isoFromProvince() : string
- Get the ISO code of a province based on its name and language.
- init() : array<string|int, mixed>
- Load provinces based on the selected country.
- LA() : array<string|int, mixed>
- List of provinces in Laos, sorted by Lao name.
- TH() : array<string|int, mixed>
- List of provinces in Thailand, sorted by Thai name.
Methods
all()
Get a list of all provinces.
public
static all([string $country = 'TH' ]) : array<string|int, mixed>
It returns the names of provinces in the specified language (defaults to English).
Parameters
- $country : string = 'TH'
-
(default: 'TH')
Return values
array<string|int, mixed> —countries()
Get a list of countries with installed provinces.
public
static countries() : array<string|int, mixed>
Return values
array<string|int, mixed> —get()
Get the name of a province based on its ISO code and language.
public
static get(int $iso[, string $lang = '' ][, string $country = 'TH' ]) : string
If the language is not specified, it uses the current language. Returns an empty string if the province is not found.
Parameters
- $iso : int
- $lang : string = ''
- $country : string = 'TH'
-
(default: 'TH')
Tags
Return values
string —isoFromProvince()
Get the ISO code of a province based on its name and language.
public
static isoFromProvince(string $province[, string $lang = '' ][, string $country = 'TH' ]) : string
Parameters
- $province : string
-
The name of the province
- $lang : string = ''
-
The language code for the desired language (e.g., 'th' for Thai, 'en' for English)
- $country : string = 'TH'
-
(default: 'TH')
Return values
string —The ISO code of the province
init()
Load provinces based on the selected country.
private
static init(string $country) : array<string|int, mixed>
If not specified, it uses Thailand as the default country.
Parameters
- $country : string
Return values
array<string|int, mixed> —LA()
List of provinces in Laos, sorted by Lao name.
private
static LA() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array containing province data for Laos
TH()
List of provinces in Thailand, sorted by Thai name.
private
static TH() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array containing province data for Thailand