词条 | microtime |
释义 | microtime(PHP 3, PHP 4 ) microtime -- 返回当前 UNIX 时间戳和微秒数 函数原型与详细说明string microtime ( void ) 返回格式为“msec sec”的字符串,其中 sec 是当前的 Unix 时间戳,msec 是微秒部分。本函数仅在支持 gettimeofday() 系统调用的操作系统下可用。 字符串的两部分都是以秒为单位返回的。 例子<?php function getmicrotime(){ list($usec, $sec) = explode(" ",microtime()); return ((float)$usec + (float)$sec); } $time_start = getmicrotime(); for ($i=0; $i < 1000; $i++){ //do nothing, 1000 times } $time_end = getmicrotime(); $time = $time_end - $time_start; echo "Did nothing in $time seconds"; ?> |
随便看 |
百科全书收录4421916条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。