Home > Article > Backend Development > PHP learning to calculate the running time of the program_PHP tutorial
php learning to calculate program running time
function gettime(){
$starttime=microtime(true); //Get the time when the program starts execution
mt_rand(1,10); //The code you execute liehuo. net
$endtime=microtime(true);//Get the time when the program execution ends
$total=$endtime-$starttime; //Calculate the difference
return $total;
}
echo gettime();
?>
Original address: http://www.52blogger.com/archives/5