(PHP 5 >= 5.2.0, PHP 7, PHP 8)
DateTimeZone::listIdentifiers -- timezone_identifiers_list — 返回一個包含了所有時區(qū)標示符的索引數組。
面向對象風格
$what = DateTimeZone::ALL, string $country = null): array過程化風格
whatDateTimeZone 類中的常量之一。
country由兩個字母組成,ISO 3166-1 兼容的國家代碼。
注意: 只有當
what被設置為DateTimeZone::PER_COUNTRY時,該選項才會被使用。
成功,返回數組,失敗則返回false.
| 版本 | 說明 |
|---|---|
| 5.3.0 |
添加可選的 what 和
country 參數。
|
示例 #1 timezone_identifiers_list() 函數的范例:
<?php
$timezone_identifiers = DateTimeZone::listIdentifiers();
for ($i=0; $i < 5; $i++) {
echo "$timezone_identifiers[$i]\n";
}
?>
以上例程的輸出類似于:
Africa/Abidjan Africa/Accra Africa/Addis_Ababa Africa/Algiers Africa/Asmara