In order to test the running time of a broken program, I specially wrote such a class and added comments. It mainly uses several functions, the array list function list(), and the string is divided into the array function explode() to obtain the time. Stamp and microseconds microtime(), divide the microseconds into arrays and convert them into variables for processing, force the converted data to use floating point points to process, calculate the program duration, for everyone to learn and refer to, if you have any good suggestions Welcome to communicate.
Step 1: Download the php test program we need to use for this lesson and run it Time class: //m.sbmmt.com/xiazai/leiku/262
Step 2: After the download is completed, find the php class file, extract it to the local server, and create a new php document!
Step 3: We call this class in this new file and instantiate this class:
<?php //举例 include_once "ceshi.php";//引入类文件 $time=new runTime(); //实例化 $time->star(); for ($i=1;$i<=1000;$i++){ echo("a"); } $time->stop(); echo $time->spent(); ?>
##The running results are as shown below:
##Note:
We are here to introduce the idea and the simplest example. More friends can try it themselves.
The above is the detailed content of Development ideas for PHP test program running time. For more information, please follow other related articles on the PHP Chinese website!