Php Get Script Execution time

Php Get Script Execution time . Determine the time it takes for a script in PHP to execute. To find out how long it takes for your PHP script to execute, use the following two functions.

Call the startTime function and store the return value in a variable at the beginning of the script, then pass the variable to the execTime function and display it at the end:

Php Get Script

function startTime() {
$mtime = microtime();
$mtime = explode(' ', $mtime);
$secs = $mtime[1] + $mtime[0];
return $secs;
function execTime($start) {
$end = startTime();
$total = $end - $start;
return '<Br>'.sprintf('Executed in %.6f seconds.', $total);
$start = startTime();
//the code.....
echo execTime($start);


%d bloggers like this: