|
|
 |
microtime (PHP 3, PHP 4, PHP 5) microtime --
返回当前 UNIX 时间戳和微秒数 说明string microtime ( void )
返回格式为“msec sec”的字符串,其中 sec 是当前的 Unix
时间戳,msec 是微秒部分。本函数仅在支持 gettimeofday()
系统调用的操作系统下可用。
字符串的两部分都是以秒为单位返回的。
例子 1. microtime() 例子 |
<?php
function getmicrotime(){
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
$time_start = getmicrotime();
for ($i=0; $i < 1000; $i++){
}
$time_end = getmicrotime();
$time = $time_end - $time_start;
echo "Did nothing in $time seconds";
?>
|
|
参见 time()。
| |