<span>function </span><span>microtime_float </span><span>() </span><span>{ </span><span>list</span><span>( </span><span>$usec </span><span>, </span><span>$sec </span><span>) </span><span>= </span><span>explode </span><span>( </span><span>" " </span><span>, </span><span>microtime </span><span>()); </span><span>$sec</span><span>=(string)</span><span>$sec</span><span>; </span><span>$sec</span><span>=</span><span>substr</span><span>(</span><span>$sec</span><span>,</span><span>-</span><span>4</span><span>); </span><span>return </span><span>(</span><span>(float) </span><span>$sec </span><span>+(float)</span><span>$usec</span><span>); </span><span>} 这段代码只能计算到时间戳后四位的结果,大概就是一小时之内的执行时间,想要检测更多的话,只要 修改substr中的截取的长度,但是要注意哈,float最大只支持14位哦。 </span>
The above has introduced the execution time of sharing a PHP code, accurate to the microsecond level, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.