note 55357 added to function.microtime
| From: | len at iceberg dot lu | Date: | Mon, 01 Aug 2005 06:37:33 +0000 |
| Subject: | note 55357 added to function.microtime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-92853@lists.php.net to get a copy of this message | ||
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';
?>
----
Submitter IP: 217.114.212.98
----
Manual Page -- http://www.php.net/manual/en/function.microtime.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+55357
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55357&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55357&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55357&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55357&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55357&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55357&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+55357&report=yes
Search -- http://master.php.net/manage/user-notes.php