public static function getRegion($locale)
    {
        $parts = explode('-', str_replace('_', '-', $locale));

        if (count($parts) === 1) {
            return '';
        }

        $region = end($parts);

        if (strlen($region) === 4) {
            return '';
        }

        if ($region === 'POSIX') {
            $region = 'US';
        }

        return strtoupper($region);
    }
public static function getRegion($locale)
    {
        $parts = explode('-', str_replace('_', '-', $locale));

        if (count($parts) === 1) {
            return '';
        }

        $region = end($parts);

        if (strlen($region) === 4) {
            return '';
        }

        if ($region === 'POSIX') {
            $region = 'US';
        }

        return strtoupper($region);
    }
public static function getRegion ( $ locale ) { $ parts = explode ( '-' , str_replace ( '_' , '-' , $ locale ) ) ; if ( count ( $ parts ) === 1 ) { return '' ; } $ region = end ( $ parts ) ; if ( strlen ( $ region ) === 4 ) { return '' ; } if ( $ region === 'POSIX' ) { $ region = 'US' ; } return strtoupper ( $ region ) ; }
Get the region for the input locale

@param string $locale Input locale (e.g. de-CH-1991)
@return string Region (e.g. CH)
Get the region for the input locale