※このサンプルの解説は、「CGIの扉」をすべて読み終えてる方を前提としています。
- 【時間関数のテスト】
-
time = 1756464067
gmtime(time) = Fri Aug 29 10:41:07 2025
gmtime() = Fri Aug 29 10:41:07 2025
gmtime = Fri Aug 29 10:41:07 2025
localtime(time) = Fri Aug 29 19:41:07 2025
localtime() = Fri Aug 29 19:41:07 2025
localtime = Fri Aug 29 19:41:07 2025
(localtime)[$i] = 7 41 19 29 7 125 5 240 0
$year $mon $mday $hour $min $sec = 125 7 29 19 41 7
$fmt0 = "%04d/%02d/%02d %02d:%02d:%02d"
sprintf($fmt0, $year+1900,$mon+1,$mday,$hour,$min,$sec) = 2025/08/29 19:41:07
substr(localtime, 0, 3) = Fri