function countries_api_get_name in Country codes API 5
Same name and namespace in other branches
- 6 countries_api.module \countries_api_get_name()
ISO 3166-1-alpha-#n code to country name API function
Parameters
$code : Either an iso2 or iso3 Country Code to search by.
Return value
string Returns country name as string.
2 calls to countries_api_get_name()
- CountriesApiTest::test_countries_api_get_name in tests/
countries_api.test - Function to test countries_api_get_name() results
- CountriesApiTest::test_invalid_countries_api_get_name in tests/
countries_api.test - Function to test countries_api_get_name() results with invalid name
File
- ./
countries_api.module, line 68
Code
function countries_api_get_name($code) {
if (strlen(trim($code)) == 2) {
return countries_api_iso2_get_name($code);
}
elseif (strlen(trim($code)) == 3) {
return countries_api_iso3_get_name($code);
}
else {
return null;
}
}