Home > php教程 > php手册 > PHP中的time与microtime

PHP中的time与microtime

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:07:32
Original
1948 people have browsed it

最近发现自己越来越老了,很多 api 和 函数 记得怎么用但总是会小小的忘记细节,比如: time time()函数是返回1970-01-01 00:00:00 到目前为止的时间戳(秒为单位); 我这次犯的错误是:认为即使相邻的两次调用,返回值不一样。 因此一般的程序中(运行时间

最近发现自己越来越老了,很多 api 和 函数 记得怎么用但总是会小小的忘记细节,比如:

time

time()
函数是返回1970-01-01 00:00:00 到目前为止的时间戳(秒为单位);
Copy after login

我这次犯的错误是:认为即使相邻的两次调用,返回值不一样。

因此一般的程序中(运行时间小于1s),那么不管你调用多少次 time() 返回的值都是一样的

microtime

microtime()
返回值是 1970-01-01 00:00:00 到目前为止的时间戳(秒为单位)和当前时间的微秒数
Copy after login

因此,即使相邻两次的调用,返回值也不一样。

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template