class StatesProvincesList (View source)

Properties

protected $localizedStatesProvinces

Methods

array
getAll()

Returns the list of States/Provinces for some countries (States/Provinces are sorted alphabetically).

string|null
getStateProvinceName(string $code, string $country)

Returns the name of a specified State/Province in a specified Country.

array|null
getStateProvinceArray(string $country)

Returns a list of States/Provinces for a country.

array
getStates() deprecated

Returns the list of US states.

array
getCanadianProvinces() deprecated

Returns the list of Canadian provinces.

Details

array getAll()

Returns the list of States/Provinces for some countries (States/Provinces are sorted alphabetically).

Return Value

array

Returns an array whose keys are the country codes and the values are arrays (with keys: State/Province code, values: State/Province names)

string|null getStateProvinceName(string $code, string $country)

Returns the name of a specified State/Province in a specified Country.

Parameters

string $code

the State/Province code

string $country

the Country code

Return Value

string|null

returns the State/Province name (if found), or null if not found

array|null getStateProvinceArray(string $country)

Returns a list of States/Provinces for a country.

Parameters

string $country

the country code

Return Value

array|null

if the Country is supported, the function returns an array (whose keys are the States/Provinces codes and the values are their names); returns null if $country is not supported

array getStates() deprecated

deprecated Use getStateProvinceArray('US')

Returns the list of US states.

Return Value

array

returns an array whose keys are the US State codes and the values are their names

array getCanadianProvinces() deprecated

deprecated Use getStateProvinceArray('CA')

Returns the list of Canadian provinces.

Return Value

array

returns an array whose keys are the Canadian Provinces codes and the values are their names