Home > Backend Development > PHP Tutorial > How to calculate the execution time of a program_PHP Tutorial

How to calculate the execution time of a program_PHP Tutorial

WBOY
Release: 2016-07-13 10:52:19
Original
799 people have browsed it

function getmicrotime(){
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec (float)$sec);
}

$time_start = getmicrotime();//Start timing and place it in the program header

for ($i=0; $i < 1000; $i ){
//do nothing, 1000 times
}

$time_end = getmicrotime();//End timing and put it at the end
$time = $time_end - $time_start;

echo "Did nothing in $time seconds";

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632500.htmlTechArticlefunction getmicrotime(){ list($usec, $sec) = explode( ,microtime()); return ( (float)$usec (float)$sec); } $time_start = getmicrotime();//Start timing and put it in the program header for ($i=0; $i...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template