Php records the code execution time (implementation code ). Copy the code as follows: $ t1microtime (true );... run the code... $ t2microtime (true); echo time consumed. round ($ t2-$ t1, 3 ). seconds. microtime () if there is a tru
The code is as follows:
$ T1 = microtime (true );
//... Execute the code...
$ T2 = microtime (true );
Echo 'elapsed Time'. round ($ t2-$ t1, 3). 'second ';
To put it simply.Microtime () if it contains a true parameter, a floating point type is returned. in this way, t1 and t2 get two floating point numbers, and the difference is obtained after subtraction. because the number of floating point digits is very long or uncertain, we can use a round () to retrieve the three digits after the decimal point. in this way, our goal is achieved ~
The http://www.bkjia.com/PHPjc/327993.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/327993.htmlTechArticle code is as follows: $ t1 = microtime (true );//... run the code... $ t2 = microtime (true); echo 'timeout '. round ($ t2-$ t1, 3 ). 'second'; to put it simply. microtime () if there is a tru...