Added an additional utility function to return country name from code from the Geoip class.

This commit is contained in:
drzax 2011-08-16 15:24:52 +10:00
parent dfb0504d0d
commit dbdfa010cb

10
integration/Geoip.php Executable file → Normal file
View File

@ -424,6 +424,16 @@ class Geoip {
$name = isset(Geoip::$iso_3166_countryCodes[$code]) ? Geoip::$iso_3166_countryCodes[$code] : null;
return $name;
}
/**
* Returns the country code from a country name.
*
* @return null|string String if the country name is found, null otherwise
*/
static function countryName2code($name) {
$code = array_search($name, Geoip::$iso_3166_countryCodes);
return ($code) ? $code : null;
}
/**
* Returns an array of ISO Country Codes -> Country Names