写了一段代码,需要测试一下执行时间,怎么办?使用 microtime();方法即可。
- <?php
- use JajoJSONDB;
- $json_db = new JSONDB( __DIR__ );
- $start_time = microtime(true);
- for ($i=0; $i < 10000; $i++) {
- $json_db->insert( 'users.json',
- [
- 'name' => 'Thomas',
- 'state' => 'Nigeria',
- 'age' => 22
- ]
- );
- }
- $end_time = microtime(true);
- echo (($end_time - $start_time)*1000) . "毫秒 rn";
- exit;
- 1、本站大部分内容均收集于网络,若内容侵犯到您的权益,请发送邮件至:service@wuyanshuo.cn,我们将第一时间处理!
- 2、本站资源所需价格并非资源售卖价格,是收集、整理、编辑以及本站运营的适当补贴,并且本站不提供任何免费技术服务。
- 3、所有资源仅限参考和学习,版权归原作者所有,更多请阅读无言说网络服务器协议。