note 81413 deleted from function.microtime by tularis

From: Date: Sun, 22 Jun 2008 12:03:40 +0000
Subject: note 81413 deleted from function.microtime by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-140659@lists.php.net to get a copy of this message
Note Submitter: Kirik ---- Here is modified Fabian Otto code: function processing_time($START=false) { $an = 4; // How much digit return after point if(!$START) return time() + microtime(); $END = time() + microtime(); return round($END - $START, $an); } How it's working? Wery simply! =) Just call the function processing_time() in the begining of script, and put result in variable, then call this function again, but with $START param.. I show you, how you can use it.. Example: <?php // FUNCTIONS function processing_time($START=false) { $an = 4; // How much digit return after point if(!$START) return time() + microtime(); $END = time() + microtime(); return round($END - $START, $an); } // MAIN SCRIPT $START = processing_time(); /* Here is our big-big code.. */ $RESULT = processing_time($START); echo "Page created in $RESULT seconds."; ?> That's it! =)

« previous php.notes (#140659) next »