【发布时间】:2009-04-21 14:42:59
【问题描述】:
我正在使用echo date('H:i:s')." this step time\n";
为了知道每个函数需要多少时间才能执行。
我怎样才能知道微秒的时间?
【问题讨论】:
我正在使用echo date('H:i:s')." this step time\n";
为了知道每个函数需要多少时间才能执行。
我怎样才能知道微秒的时间?
【问题讨论】:
补充一下,还有PHP的microtime()函数,可以这样使用:
$time_start = microtime(true);
//do stuff here
$time_end = microtime(true);
$time = $time_end - $time_start;
echo "It took $time seconds\n";
【讨论】:
u 微秒(PHP 5.2.2 中添加)
【讨论】:
date('H:i:s.u'),但我总是得到000000微秒。
使用格式中的“u”标记表示毫秒。
【讨论】: