note 48502 deleted from function.microtime by tularis
| From: | tularis@php.net | Date: | Sun, 22 Jun 2008 12:16:47 +0000 |
| Subject: | note 48502 deleted from function.microtime by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-140713@lists.php.net to get a copy of this message | ||
Note Submitter: e dot nijssen at gmail dot com
----
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.