无涯教程-PHP日期和时间函数。 - gettimeofday()

44 阅读1分钟

gettimeofday() - 语法

mixed gettimeofday ( [bool $return_float] );

这是Unix系统调用gettimeofday(2)的接口。它返回一个关联数组,其中包含从系统调用返回的数据。

Sr.No Parameter & Description
1

return_float(可选)

当设置为true时,返回的是浮点数而不是数组。

gettimeofday() - 返回值

默认情况下返回数组。如果设置了RETURN_FLOAT,则返回一个浮点数。

返回数组键-的含义

  • [sec]                - seconds since the Unix Epoch
  • [usec]              - microseconds
  • [minuteswest] - minutes west of Greenwich
  • [dsttime]         - type of dst correction

gettimeofday() - 示例

<?php
   print_r(gettimeofday());

echo gettimeofday(true); ?>

这将产生以下输出-

Array (
   [sec] => 1073504408
   [usec] => 238215
   [minuteswest] => 0
   [dsttime] => 1
)

1073504408.23910

参考链接

www.learnfk.com/php/php-fun…