Revision: 56461
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 29, 2012 09:38 by anagaiyahoocom
Initial Code
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); } //Usage $start = startTime(); //the code..... echo execTime($start);
Initial URL
Initial Description
Place startTime() at beginning where timing is to start. Get the return value and set the start time variable. At end of script to time call execTime($start) passing the start time and this will calculate elapsed time of execution.
Initial Title
PHP Code Execution Timing Script
Initial Tags
php
Initial Language
PHP