note 70877 deleted from function.microtime by tularis

From: Date: Sun, 22 Jun 2008 12:08:05 +0000
Subject: note 70877 deleted from function.microtime by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-140676@lists.php.net to get a copy of this message
Note Submitter: sneskid at hotmail dot com ---- I've noticed when running microtime() for the first time, there is a bit of a delay (v 5.1.4). Try this: <?php function stuff() { $t1 = microtime(true); $t2 = microtime(true); echo sprintf('%.6f', ($t2 - $t1) ) . "\r\n"; } //microtime(); stuff(); stuff(); stuff(); ?> The first result will probably be a little higher. I get: 0.000004 0.000001 0.000001 Then try calling microtime() just once before the stuff()s. The first run will drop by a bit. Don't forget sprint() can format your numbers.

« previous php.notes (#140676) next »