php微秒

Dun*_*oit 3 php datetime

我正在使用
echo date('H:i:s')." this step time\n";
,以便知道每个函数需要多长时间才能执行.

我怎么知道微秒的时间呢?

kar*_*m79 9

只是添加,有PHP的microtime()函数,可以像这样使用:

$time_start = microtime(true);

//do stuff here

$time_end = microtime(true);
$time = $time_end - $time_start;

echo "It took $time seconds\n";
Run Code Online (Sandbox Code Playgroud)