note 75730 added to function.microtime
| From: | pizza23 at yahoo dot com | Date: | Wed, 13 Jun 2007 17:11:01 +0000 |
| Subject: | note 75730 added to function.microtime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-127451@lists.php.net to get a copy of this message | ||
I needed a way to give the total time to execute a whole page of code that included MySQL code as
well and the exmples show did not quite help, Althought they lead me to the answer.
<?PHP
$starttimer = time()+microtime();
/*
...Page of Code
...MySQL Code
*/
$stoptimer = $time+microtime();
$timer = round($stoptimer-$starttimer,4);
echo "Page created in $timer seconds.";
?>
Result:
Page created in 4.1368 seconds.
----
Server IP: 64.71.164.2
Probable Submitter: 70.89.141.201
----
Manual Page -- http://www.php.net/manual/en/function.microtime.php
Edit -- https://master.php.net/note/edit/75730
Del: integrated -- https://master.php.net/note/delete/75730/integrated
Del: useless -- https://master.php.net/note/delete/75730/useless
Del: bad code -- https://master.php.net/note/delete/75730/bad+code
Del: spam -- https://master.php.net/note/delete/75730/spam
Del: non-english -- https://master.php.net/note/delete/75730/non-english
Del: in docs -- https://master.php.net/note/delete/75730/in+docs
Del: other reasons-- https://master.php.net/note/delete/75730
Reject -- https://master.php.net/note/reject/75730
Search -- https://master.php.net/manage/user-notes.php