原码笔记

原码笔记

php使用gettimeofday函数返回当前时间并存放在关联数组里

小诸哥 0

这篇文章主要介绍了php使用gettimeofday函数返回当前时间并存放在关联数组里的方法,涉及php中gettimeofday函数的使用技巧,需要的朋友可以参考下

本文实例讲述了php使用gettimeofday函数返回当前时间并存放在关联数组里的方法。分享给大家供大家参考。具体分析如下:

英文官方描述如下:

Key Description
sec Seconds since midnight before January 1, 1970
usec  Microseconds since the sec value
minuteswest   
Local time zone difference from GMT, in minutes
dsttime  1 iff daylight savings time is in effect,
0 iff not.

  1. <?php
  2. $Now = gettimeofday();
  3. echo "As an associative array:\n";
  4. foreach ($Now as $Key => $Value) {
  5.      echo "$Key => $Value\n";
  6. }
  7. ?>

输出结果如下:

  1. sec => 1261918156
  2. usec => 724964
  3. minuteswest => 0
  4. dsttime => 0

希望本文所述对大家的php程序设计有所帮助。

标签: 使用 函数 数组 返回 当前 时间