function countries_api_iso3_get_iso2 in Country codes API 6
Same name and namespace in other branches
- 5 countries_api.module \countries_api_iso3_get_iso2()
ISO 3166-1-alpha-3 code to ISO 3166-1-alpha-2 code API function
Parameters
$code: iso3 country code to search by.
Return value
string Returns iso2 string value of country
1 call to countries_api_iso3_get_iso2()
- CountriesAPITestCase::test_countries_api_iso3_get_iso2 in tests/
countries_api.test - Function to test countries_api_iso3_get_iso2() results
File
- ./
countries_api.module, line 141 - Countries API provides an API for official and up-to-date ISO 3166 country codes (alpha-2 and alpha-3) and names (official short names).
Code
function countries_api_iso3_get_iso2($code) {
$_country = countries_api_iso3_get_country($code);
if (!is_null($_country)) {
return $_country[COUNTRIES_API_FORMAT_ISO2];
}
return NULL;
}