note 55357 deleted from function.microtime by aidan
| From: | aidan@php.net | Date: | Mon, 01 Aug 2005 11:16:07 +0000 |
| Subject: | note 55357 deleted from function.microtime by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-92860@lists.php.net to get a copy of this message | ||
Note Submitter: len at iceberg dot lu
Reason: useless
----
This is a small code snippet that allows you to calculate the script execution time using the
microtime() function.
<?php
function take_time() {
return doubleval(ereg_replace('^0\.([0-9]*) ([0-9]*)$', '\\2.\\1',
microtime()));
}
$start_time = take_time();
/* Your script code goes here */
$end_time = take_time();
print 'Script execution took '.round($end_time - $start_time,2).' seconds';
?>