Representing microtime() values

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

 



Hi everyone

Here's a small problem that I haven't been able to figure out and hence I
figured I'd post and see if anyone can explain this to me.

It concerns the values that are being returned to me by the microtime()
function. When I run a simple line, e.g.

print microtime(true);

or

var_dump(microtime(true));

The result is usually something like: 1196104701.67.

This makes no sense to me. It is made even more perplexing by the fact that
when I run the timing example from microtime's manual page

http://www.php.net/manual/en/function.microtime.php (it's the bottom one,
for PHP 5)

I invariably get a result with loads of digits, like: 0.00072979927063
seconds. Does PHP hide the extra digits whenever I try to print it? I tried
force PHP to show them to me, but unless I am printing a direct result of a
calculation by two such numbers, I cannot get them show on the page. Even
round(microtime(), 6) does not seem to work. It only shows two digits.

How exactly does PHP handle these values internally? Does anyone know?

How about, is there a way around this?

This is important because my program is suppose to store and handle double
values and whenever I do calculations with them, I lose all but the two
digits along the way.


Tomi Kaistila
PHP Developer

-- 
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