timezone_identifiers_list()
timezone_identifiers_list() — Alias of DateTimeZone::listIdentifiers().
Built-in function of PHP 8.5. The manual lists it as available in PHP 5 >= 5.2.0, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.
timezone_identifiers_list() is an alias of DateTimeZone::listIdentifiers(): same parameters, same return value.
Signature
timezone_identifiers_list(int $timezoneGroup = DateTimeZone::ALL, ?string $countryCode = null): array
Parameters
| Parameter | Type | What it takes |
|---|---|---|
| $timezoneGroup | int | One of the DateTimeZone class constants (or a combination). |
| $countryCode | ?string | A two-letter (uppercase) ISO 3166-1 compatible country code. |
Return value
Returns the array of timezone identifiers. Only non-outdated items are returned. To get all, including outdated timezone identifiers, use the DateTimeZone::ALL_WITH_BC as value for timezoneGroup.
Example
A runnable snippet:
$identifiers = DateTimeZone::listIdentifiers(DateTimeZone::ALL); foreach ($identifiers as $tzid) { $tz = new DateTimeZone($tzid); $comments = $tz->getLocation()['comments']; echo $tzid . " (" . ($comments ?: 'Whole region') . ")\n"; }
Output:
America/Antigua (Whole region) America/Araguaina (Tocantins) America/Argentina/Buenos_Aires (Buenos Aires (BA, CF)) America/Argentina/Catamarca (Catamarca (CT), Chubut (CH)) America/Argentina/Cordoba (Argentina (most areas: CB, CC, CN, ER, FM, MN, SE, SF)) // (Output trimmed due to length)
All PHP 8.5 built-in functions
Reference card built from the PHP manual page timezone_identifiers_list() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.