note 45292 added to function.microtime

From: Date: Wed, 01 Sep 2004 11:04:23 +0000
Subject: note 45292 added to function.microtime
Groups: php.notes 
Request: Send a blank email to php-notes+get-75836@lists.php.net to get a copy of this message
Sorry guys, one time just isn't enough for me: pseudo-code usage example: splittime ("total"); splittime ("one"); do this splittime ("one"); splittime ("two"); do that splittime ("two"); splittime ("total"); The goods: Function splittime ($set) { static $timers = array(); $now = microtime(true); if (isset($timers["$set"])) { $diff = $now - $timers["$set"]; echo ">>Split $set $diff<<\n"; } else { echo ">>Start $set $now<<\n"; } $timers["$set"] = $now; } Someone else can make the output nicer while I get some sleep tonight. ---- Manual Page -- http://www.php.net/manual/en/function.microtime.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+45292 Delete -- http://master.php.net/manage/user-notes.php?action=delete+45292&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+45292&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#75836) next »