In PHP if we want to get milliseconds to pass the Microtime () and then to convert, let me give you a few examples of friends, I hope that will be helpful to everyone.
The problem is not afraid of retarded ... Remember everything?
| The code is as follows |
Copy Code |
function Getmicrotime () { List ($usec, $sec) = Explode ("", Microtime ()); return (float) $usec + (float) $sec); } |
is actually dealing with microtime () this function.
Microtime () The return value of this function is this form:
0.06261400 1303715872
The space is followed by the current timestamp, and the space is preceded by the current exact time
example, calculating the page execution time function
| The code is as follows |
Copy Code |
/** * Simple function to replicate PHP 5 behaviour */ function Microtime_float () { List ($usec, $sec) = Explode ("", Microtime ()); return (float) $usec + (float) $sec); } $time _start = Microtime_float (); Sleep for a while Usleep (100); $time _end = Microtime_float (); $time = $time _end-$time _start; echo "did nothing in $time secondsn"; ?> |
http://www.bkjia.com/PHPjc/633053.html www.bkjia.com true http://www.bkjia.com/PHPjc/633053.html techarticle in PHP If we want to get milliseconds to pass the Microtime () and then to convert, let me give you a few examples of friends, I hope that will be helpful to everyone. The problem is not afraid of retarded everything ...