You are here

function countries_api_iso3_get_iso2 in Country codes API 5

Same name and namespace in other branches
  1. 6 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()
CountriesApiTest::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 132

Code

function countries_api_iso3_get_iso2($code) {
  $_country = countries_api_iso3_get_country($code);
  if (!is_null($_country)) {
    return $_country['iso2'];
  }
  return null;
}