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

yipeiwu_com6年前PHP代码库

本文实例讲述了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.

<?php
$Now = gettimeofday();
echo "As an associative array:\n";
foreach ($Now as $Key => $Value) {
 echo "$Key => $Value\n";
}
?>

输出结果如下:

sec => 1261918156
usec => 724964
minuteswest => 0
dsttime => 0

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

相关文章

Discuz 5.0 中读取纯真IP数据库函数分析

Discuz  5.0 不在使用自己的IP数据,而是使用纯真IP的数据格式, 存取纯真IP数据库稍微有点麻烦,它的存储格式比较特殊也很有趣,具体的...

PHP中文件缓存转内存缓存的方法

前言 顾名思义文件缓存转内存缓存就是将存储在文件中的数据转到内存中去,实现磁盘操作转为内存操作,这样可以大大提高数据访问速度,并能实现缓存数据的分布式部署。文件缓存与内存缓存的介绍请参考...

php实现webservice实例

本文实例讲述了php实现webservice的方法。分享给大家供大家参考。具体实现方法如下: 首先大家要简单了解何谓webservice,接下来就做两个非常简单的例子,webservic...

PHP strtotime函数详解

先看手册介绍: strtotime — 将任何英文文本的日期时间描述解析为 Unix 时间戳 格式:int strtotime ( string $time [, int $now ]...

PHP中一个有趣的preg_replace函数详解

PHP中一个有趣的preg_replace函数详解

0x01 起因 事情的起因是下午遇到了 preg_replace 函数,我们都知道 preg_replace 函数可能会导致命令执行。现在我们来一些情况。 0x02 经过 踩坑1:...