Home > Backend Development > PHP Tutorial > How to calculate function execution time in php, php calculate function execution_PHP tutorial

How to calculate function execution time in php, php calculate function execution_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 10:02:02
Original
867 people have browsed it

How PHP calculates function execution time, PHP calculates function execution

The example in this article describes how PHP calculates function execution time. Share it with everyone for your reference. The details are as follows:

We can record the start and end time before and after the program. The difference between the two times is the execution time of the program.
Copy code The code is as follows: $long_str = "this is a test to see how much time md5 function takes to execute over this string";
// start timing from here
$start = microtime(true);
// function to test
$md5 = md5($long_str);
$elapsed = microtime(true) - $start;
echo "That took $elapsed seconds.n";
?>

The running results are as follows:

That took 7.1525573730469E-6 seconds.

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/970988.htmlTechArticleHow to calculate function execution time in PHP, PHP calculates function execution time. The example in this article describes how PHP calculates function execution time. Share it with everyone for your reference. The details are as follows: We can...
Related labels:
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template