Re: time() TIMER in seconds or just numbers

From: Date: Mon, 30 Mar 2009 21:36:03 +0000
Subject: Re: time() TIMER in seconds or just numbers
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-290865@lists.php.net to get a copy of this message
On Mon, Mar 30, 2009 at 3:35 PM, Shawn McKenzie <nospam@mckenzies.net> wrote: > Andrew Williams wrote: >> what does time(); >> >> $t1 = time(); >> >> { >> >> do something >> } >> $t2 = time(); >> >> $end_time = $t2 - $t1; >> echo $end_time; >> >> what does $end_time represent? >> >> how do you determine the next 5 mins? > > So if you haven't deduced the answer from other replies, this would > probably be more readable: > > $start_time = time();  //or microtime() > //do something > $end_time = time();  //or microtime() > > $duration = $end_time - $start_time; > echo $duration; Don't forget--microtime() without the boolean "true" as an argument will split the result into two parts. Using "true" as the argument (minus quotes, of course) gives you a floating-point representation of seconds/milliseconds/etc. -- // Todd

« previous php.general (#290865) next »