Merge pull request #44 from drzax/master

ENHANCEMENT: Added Geoip::countryName2Code($name).
This commit is contained in:
Will Rossiter 2011-08-16 00:30:08 -07:00
commit 19bfb1c83c

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