Php calculates the function execution time. Php calculates the execution time of functions. This document describes how php calculates the execution time of functions. Share it with you for your reference. Details: we can use php to calculate the function execution time and php to calculate the function execution time.
This example describes how to calculate the function execution time in php. Share it with you for your reference. The details are as follows:
We can record the start time and end time respectively before and after the program. The two time differences are the execution time of the program.
The code is as follows: <? Php
$ 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 result is as follows:
That took 7.1525573730469E-6 seconds.
I hope this article will help you with php programming.
Examples in this article describes how to calculate the function execution time in php. Share it with you for your reference. Details: we can...