Here is a description of microtime () This function, Microtime () not much, but can not know this function, it is to return the current Unix timestamp and the number of microseconds. For example: Echo Microtime (); will return: 0.08845800 1376983061. So you can use the Explode function to split it into an array as a space, then the $starttime[0]=0.08845800 (microseconds), $starttime [1]=1376983061 (the current number of seconds, equivalent to time ().
<?php
Program Run time
$starttime = Explode (' ', Microtime ());
Echo Microtime ();
/*········ Here is the code area */
for ($i =0; $i <1000000; $i + +) {
$i;
}
/*········ The above is the code area */
Program Run time
$endtime = Explode (' ', Microtime ());
$thistime = $endtime [0]+ $endtime [1]-($starttime [0]+ $starttime [1]);
$thistime = Round ($thistime, 3);
echo "This page takes time:". $thistime. "Seconds. ";
?>
PHP Calculation program Run time