note 48502 added to function.microtime
| From: | e dot nijssen at gmail dot com | Date: | Mon, 27 Dec 2004 09:51:31 +0000 |
| Subject: | note 48502 added to function.microtime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-82340@lists.php.net to get a copy of this message | ||
here is a handy script generation time code example(scrabble):
<?php
#put this in the very beginning
$timestart = microtime();
<<some code>>
#put this in the very end
$timeend = microtime();
$diff = number_format(((substr($timeend,0,9)) + (substr($timeend,-10)) - (substr($timestart,0,9)) -
(substr($timestart,-10))),4);
echo "<br><br><small><small>script generation took $diff s
</small></small>";
?>
this code will give you the time the <<some code>> took to evaluate in 4 decimals, if
you want more or less decimals, edit the last parameter in the line that defines $diff.
----
Manual Page -- http://www.php.net/manual/en/function.microtime.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+48502
Delete -- http://master.php.net/manage/user-notes.php?action=delete+48502&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48502&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48502&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48502&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48502&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48502&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+48502&report=yes
Search -- http://master.php.net/manage/user-notes.php