note 55899 deleted from function.microtime by tularis

From: Date: Sun, 22 Jun 2008 12:14:11 +0000
Subject: note 55899 deleted from function.microtime by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-140699@lists.php.net to get a copy of this message
Note Submitter: ---- <?php /** * Simple function to replicate PHP 5 behaviour */ function microtime_float() { list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } $time_start = microtime_float(); // Sleep for a while usleep(100); $time_end = microtime_float(); //***** //***** Use round with 4 spaces after the decimal for shorter times. The output would be 0.003 seconds //***** $time = round($time_end - $time_start, 4); echo "Did nothing in $time seconds\n"; ?>

« previous php.notes (#140699) next »