Copy code The code is as follows:
$t1 = microtime(true);
//... Execute the code...
$t2 = microtime(true);
echo 'time-consuming'.round($t2-$t1,3).'seconds';
Say briefly . If microtime() takes a true parameter, it will return a floating point type. In this way, t1 and t2 will get two floating point numbers, and the difference will be obtained after subtracting them. Since the number of floating point digits is very small, long, or uncertain, so we use round() to take out 3 digits after the decimal point. In this way, our goal is achieved~
http://www.bkjia.com/PHPjc/327993.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327993.htmlTechArticleCopy the code The code is as follows: $t1 = microtime(true); // ... execute the code... $ t2 = microtime(true); echo 'time-consuming'.round($t2-$t1,3).'seconds'; Let's talk briefly. microtime() If you bring a tru...