public static function names($codes = null, $sort = true)
    {
        $list = [];
        $sortList = [];
        $codes = $codes ?: static::codes();
        foreach ($codes as $code) {
            $intlTimeZone = \IntlTimeZone::createTimeZone($code);
            $name = static::intlName($intlTimeZone);
            if ('(GMT) GMT' != $name) {
                $list[$code] = $name;
                $sortList[$code] = abs($intlTimeZone->getRawOffset());
            }
        }

        if ($sort) {
            array_multisort($sortList, $list);
        }

        return $list;
    }
public static function names($codes = null, $sort = true)
    {
        $list = [];
        $sortList = [];
        $codes = $codes ?: static::codes();
        foreach ($codes as $code) {
            $intlTimeZone = \IntlTimeZone::createTimeZone($code);
            $name = static::intlName($intlTimeZone);
            if ('(GMT) GMT' != $name) {
                $list[$code] = $name;
                $sortList[$code] = abs($intlTimeZone->getRawOffset());
            }
        }

        if ($sort) {
            array_multisort($sortList, $list);
        }

        return $list;
    }
public static function names ( $ codes = null , $ sort = true ) { $ list = [ ] ; $ sortList = [ ] ; $ codes = $ codes ? : static :: codes ( ) ; foreach ( $ codes as $ code ) { $ intlTimeZone = \ IntlTimeZone :: createTimeZone ( $ code ) ; $ name = static :: intlName ( $ intlTimeZone ) ; if ( '(GMT) GMT' != $ name ) { $ list [ $ code ] = $ name ; $ sortList [ $ code ] = abs ( $ intlTimeZone -> getRawOffset ( ) ) ; } } if ( $ sort ) { array_multisort ( $ sortList , $ list ) ; } return $ list ; }
Returns list of timezone names
@inheritdoc
@param bool $sort a boolean indicating to sort the result according to the GMT offset.
@return array
Returns list of timezone names