The microtime function in php records the code execution time. To put it simply. microtime () if it contains a true parameter, a floating point type is returned. in this way, t1 and t2 get two floating point numbers, and the difference is obtained after subtraction. for a brief description of floating point. microtime () if it contains a true parameter, a floating point type is returned. in this way, t1 and t2 get two floating point numbers, and the difference is obtained after subtraction. because the number of floating point digits is very long or uncertain, we can use a round () to retrieve the three digits after the decimal point. in this way, our goal is achieved ~
| The code is as follows: |
|
$ T1 = microtime (true ); //... Execute the code... $ T2 = microtime (true ); Echo 'elapsed Time'. round ($ t2-$ t1, 3). 'second '; |
To put it simply. microtime () if it contains a true parameter, a floating point type is returned. in this way, t1 and t2 get two floating point numbers, and the difference is obtained after subtraction. because the number of floating point digits is very long or uncertain, we can use a round () to retrieve the three digits after the decimal point. in this way, our goal is achieved ~
Microtime usage
The microtime () function returns the current Unix timestamp and the number of microseconds.
Syntax
Microtime (get_as_float) parameter description
If the get_as_float parameter is given and its value is equivalent to TRUE, this function returns a floating point number.
Period. microtime () if it has a true parameter, the returned value will be a floating point type. in this way, t1 and t2 get two floating point numbers, and the difference between them is obtained after subtraction. because of the floating point...