note 11862 added to function.microtime.php
| From: | slicky at newshelix dot com | Date: | Sat, 10 Mar 2001 11:19:15 +0000 |
| Subject: | note 11862 added to function.microtime.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-12158@lists.php.net to get a copy of this message | ||
This should do the trick (the same as above just shortened.
function getmicrotime(){
list($sec, $usec) = explode(" ",microtime());
return ($sec + $usec);
}
then set somewhere a start point in your script where the measure should
start. (something akin to this
$time_start = getmicrotime();)
and of course where the measure should stopp.( $time_end = getmicrotime(); )
underneath place this one
$time = $time_end - $time_start;
Now evaluate $time, that's it.
Notice that if you are measuring a long time period (10 sec and over) i wouldn't recommend to
measure with microtime(), use the normal time stamp instead.
Then all you have to do is:
$time_start = time();
....your code....
$time_end = time();
$time = $time_end - $time_start;
http://www.php.net/manual/en/function.microtime.php