You are here

function countries_api_get_country in Country codes API 6

Same name and namespace in other branches
  1. 5 countries_api.module \countries_api_get_country()

ISO 3166-1-alpha-#n code to country API function

Parameters

$code: An string containg the iso3 value

Return value

string Returns an array containing the country fields

File

./countries_api.module, line 33
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_get_country($code) {
  if (drupal_strlen(trim($code)) == 2) {
    return countries_api_iso2_get_country($code);
  }
  elseif (drupal_strlen(trim($code)) == 3) {
    return countries_api_iso3_get_country($code);
  }
  return NULL;
}