Test Script Execution Time

// start timing

$mtime = microtime();
$mtime = explode(” “,$mtime);
$mtime = $mtime[1] + $mtime[0];
$starttime = $mtime;

// code to execute

Code to Execute HERE

// revisit timer

$mtime = microtime();
$mtime = explode(” “,$mtime);
$mtime = $mtime[1] + $mtime[0];
$endtime = $mtime;
$totaltime = number_format(($endtime – $starttime),5);

echo “<br /><span style=’display:none;’>Script executed in ” . $totaltime . ” microseconds</span>”;
echo “<br /><span style=’display:none;’>Using ” . memory_get_peak_usage(1) . ” bytes of ram</span>”;

Tags: , , ,

Leave a Reply

You must be logged in to post a comment.