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程序设计有所帮助。

相关文章

解析php curl_setopt 函数的相关应用及介绍

一、要想使用curl_setopt 这个函数必须在服务器里边进行编译curl这个组件,怎么安装编译这个组件请具体到google搜索二、curl_setopt的php帮助文档的解释bool...

php遍历类中包含的所有元素的方法

本文实例讲述了php遍历类中包含的所有元素的方法。分享给大家供大家参考。具体分析如下: 这里可获得php类包含的所有元素以key-value的形式输出 class MyTestCla...

浅析php中三个等号(===)和两个等号(==)的区别

先举个列子:比如你一个函数会返回这几种情况:1、大于0的数2、小于0的数3、等于0的数(也就是0啦)4、False(失败时)这时候如果你想捕获失败的情况,你就必须用===,而不能用==因...

php set_magic_quotes_runtime() 函数过时解决方法

把函数: set_magic_quotes_runtime($new_setting); 替换成: ini_set("magic_quotes_runtime", $new_settin...

Php Cookie的一个使用注意点

复制代码 代码如下:<?php setcookie('test', 'this is a cookie test'); echo ($_COOKIE['test']); ?>...