剛剛看文檔,感覺這兩個函數很相似,都是根據時間戳返回日期,時間等信息的數組,而且從返回的信息上來看getdate完全可以取代localtime,那麼請問localtime存在的意義是什麼呢?
剛剛看文檔,感覺這兩個函數很相似,都是根據時間戳返回日期,時間等信息的數組,而且從返回的信息上來看getdate完全可以取代localtime,那麼請問localtime存在的意義是什麼呢?
localtime
取得的陣列中,年是從 1900 開始的
<code> <?php $localtime = localtime(); $localtime_assoc = localtime(time(), true); //print_r($localtime); print_r($localtime_assoc); ?> <?php $today = getdate(); print_r($today); ?></code>
<code>Array ( [tm_sec] => 37 [tm_min] => 22 [tm_hour] => 3 [tm_mday] => 9 [tm_mon] => 9 [tm_year] => 116 [tm_wday] => 0 [tm_yday] => 282 [tm_isdst] => 0 ) Array ( [seconds] => 37 [minutes] => 22 [hours] => 3 [mday] => 9 [wday] => 0 [mon] => 10 [year] => 2016 [yday] => 282 [weekday] => Sunday [month] => October [0] => 1475983357 ) </code>