note 81414 added to function.microtime

From: Date: Wed, 27 Feb 2008 05:51:51 +0000
Subject: note 81414 added to function.microtime
Groups: php.notes 
Request: Send a blank email to php-notes+get-136521@lists.php.net to get a copy of this message
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! =) ---- Server IP: 66.207.199.35 Probable Submitter: 99.230.254.8 ---- Manual Page -- http://www.php.net/manual/en/function.microtime.php Edit -- https://master.php.net/note/edit/81414 Del: integrated -- https://master.php.net/note/delete/81414/integrated Del: useless -- https://master.php.net/note/delete/81414/useless Del: bad code -- https://master.php.net/note/delete/81414/bad+code Del: spam -- https://master.php.net/note/delete/81414/spam Del: non-english -- https://master.php.net/note/delete/81414/non-english Del: in docs -- https://master.php.net/note/delete/81414/in+docs Del: other reasons-- https://master.php.net/note/delete/81414 Reject -- https://master.php.net/note/reject/81414 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#136521) next »