Calculate MySQL Execution Time/Duration; Calculate PHP Script Execution Time/Duration

Content

<?php $stats = array(); function start(){     global $stats;     $stats['time_start'] = microtime(true); }   function stop() {     global $stats;     $stats['time_end'] = microtime(true);     $stats['time_total'] = $stats['time_end'] - $stats['time_start'];     echo 'completed in ' . $stats['time_total'] . ' seconds' . "\n";     exit; } ?> <?php // example usage start();   for ($i = 0; $i <= 1000; $i++) {     // Do something }   stop();

You may may interested in the PHP Measure Execution & Elapsed Time for Functions or Scripts