Re: time() TIMER in seconds or just numbers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 30, 2009 at 3:35 PM, Shawn McKenzie <nospam@xxxxxxxxxxxxx> 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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux