Ask a FLOAT question $ usec: number of current microseconds, $ sec: current number of seconds list ($ usec, $ sec) explode (, microtime (); $ time1 (float) $ usec + (float) $ sec; list ($ usec, $ sec) explode (, microtime (ask a FLOAT question)
// $ Usec: number of current microseconds, $ sec: current number of seconds
List ($ usec, $ sec) = explode ('', microtime ());
$ Time1 = (float) $ usec + (float) $ sec;
List ($ usec, $ sec) = explode ('', microtime ());
$ Time2 = (float) $ usec + (float) $ sec;
Echo $ time2-$ time1;
The result outputs a number similar to this: 3.40938568115E-5.
Problem:
Print $ usec and $ sec separately, and output the following number: 0.95312700 1326693637
$ Time output: 1326693637.95
Why does $ time1-$ time2 output "3.40938568115E-5 "???
Thank you.
------ Solution --------------------
Discussion
Reference:
You can customize the format.
PHP code
Echo sprintf ('%. 16f', $ time2-$ time1 );
I don't know why this happens by default...
------ Solution --------------------
Because the value is too small to be represented by decimal places, it can only be represented by scientific notation.
------ Solution --------------------
Because your $ time2-$ time1 value is too small, it is about 0.0000340938568115
In this way, the previous 0 values affect the accuracy display, so it is automatically changed to scientific notation.
3.40938568115E-5 is equivalent to 3.40938568115*10 ^-5
------ Solution --------------------
Discussion
In fact, I mean:
$ Time1 and $ time2 are similar to the following numbers: 1326693637.95
Then they subtract two decimal places. why are there so many decimal places ??