This article mainly introduced the PHP computation function execution Time method, takes the MD5 function to encrypt the running time as an example to analyze the PHP computation function running time skill, the need friend may refer to the next
The example in this article describes the way in which PHP calculates function execution time. Share to everyone for your reference. as follows:
We can record the start and end times separately before and after the program, and the two time difference is the program execution times.
The code is as follows: <?php
$long _str = "This are a test to" so much time MD5 function takes to execute over this string ";
Start timing from
$start = Microtime (true);
function to test
$MD 5 = MD5 ($long _str);
$elapsed = Microtime (True)-$start;
echo "That took $elapsed SECONDS.N";
?>
The results of the operation are as follows:
That took 7.1525573730469E-6 seconds.
I hope this article will help you with your PHP program design.