(PHP 5 >= 5.3.0, PHP 7, PHP 8)
DateTimeZone::getLocation -- timezone_location_get — 傳回時區的位置資訊
物件導向風格
程序式風格
傳回時區的位置資訊,包含國家代碼、經緯度和註釋。
包含時區位置資訊的陣列,若失敗則傳回 false
。
範例 #1 DateTimeZone::getLocation() 範例
<?php
$tz = new DateTimeZone("Europe/Prague");
print_r($tz->getLocation());
print_r(timezone_location_get($tz));
?>
以上範例會輸出:
Array ( [country_code] => CZ [latitude] => 50.08333 [longitude] => 14.43333 [comments] => ) Array ( [country_code] => CZ [latitude] => 50.08333 [longitude] => 14.43333 [comments] => )