Home >Backend Development >PHP Tutorial >Improve PHP program performance and load testing_PHP tutorial
An example code about improving the performance and load testing of PHP programs. Friends in need can take a look at how to improve the performance of their own programs.
Calculate execution time
Use the following simple method to calculate the execution time of a program (subtle)
The code is as follows
| Copy code | ||||
$start_time = microtime(true);
function getExecTime ($start_time) { | return microtime(true)-$start_time;
$timer->start();
static $profile; // Return the times stored in profile, then erase it