Horde_Nls::getCountryISO PHP Method

getCountryISO() public static method

Returns either a specific or all ISO-3166 country names.
public static getCountryISO ( string $code = null ) : mixed
$code string The ISO 3166 country code.
return mixed If a country code has been requested will return the corresponding country name. If empty will return an array of all the country codes and their names.
    public static function getCountryISO($code = null)
    {
        if (!isset(self::$_cache['iso3166'])) {
            include __DIR__ . '/Nls/Countries.php';
            self::$_cache['iso3166'] = $countries;
        }
        if (empty($code)) {
            return self::$_cache['iso3166'];
        }
        $code = Horde_String::upper($code);
        return isset(self::$_cache['iso3166'][$code]) ? self::$_cache['iso3166'][$code] : null;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Returns avaiable countries
  */
 static function getCountries()
 {
     try {
         return Horde::loadConfiguration('countries.php', 'countries', 'folks');
     } catch (Horde_Exception $e) {
         return Horde_Nls::getCountryISO();
     }
 }
All Usage Examples Of Horde_Nls::getCountryISO