DateTimeZone::getLocation

timezone_location_get

(PHP 5 >= 5.3.0, PHP 7, PHP 8)

DateTimeZone::getLocation -- timezone_location_get返回與時(shí)區(qū)相關(guān)的定位信息。

說明

面向?qū)ο箫L(fēng)格

public DateTimeZone::getLocation(): array

過程化風(fēng)格

返回與時(shí)區(qū)相關(guān)的定位信息,包括國(guó)家代碼,緯度/經(jīng)度和解釋。

參數(shù)

object

僅過程化風(fēng)格:由 timezone_open() 返回的 DateTimeZone 對(duì)象。

返回值

數(shù)組,包含與時(shí)區(qū)相關(guān)的定位信息。

范例

示例 #1 DateTimeZone::getLocation() 函數(shù)的范例:

<?php
$tz 
= new DateTimeZone("Europe/Prague");
print_r($tz->getLocation());
print_r(timezone_location_get($tz));
?>

以上例程會(huì)輸出:

Array
(
    [country_code] => CZ
    [latitude] => 50.08333
    [longitude] => 14.43333
    [comments] => 
)
Array
(
    [country_code] => CZ
    [latitude] => 50.08333
    [longitude] => 14.43333
    [comments] => 
)