note 112062 deleted from function.microtime by aharvey

From: Date: Fri, 24 May 2013 17:12:23 +0000
Subject: note 112062 deleted from function.microtime by aharvey
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-194902@lists.php.net to get a copy of this message
Note Submitter: przemek_w ---- Functions I use to calculate and show page generation time. <?php // Insert this block of code at the very top of your page: function DEBUG_TIME_START(&$start) { $time = microtime(); $time = explode(" ", $time); $time = $time[1] + $time[0]; $start = $time; } // Place this part at the very end of your page function DEBUG_TIME_END($start) { $time = microtime(); $time = explode(" ", $time); $time = $time[1] + $time[0]; $finish = $time; $totaltime = ($finish - $start); return sprintf ("This page took %.2f seconds to load.\n", $totaltime); } ?> Usage: <?php DEBUG_TIME_START($start); /* Do stuff.... */ print DEBUG_TIME_END($start); ?> Example output: This page took 22.41 seconds to load.

« previous php.notes (#194902) next »