PHP itself does not provide a function that returns the number of milliseconds, but provides a microtime () function that makes it easy to define a function that returns a number of milliseconds
PHP itself does not provide a function that returns the number of milliseconds. But it provides a microtime () function that returns an array that contains two elements, one in seconds and one in milliseconds, which makes it easy to define a function that returns a number of milliseconds, such as the following code: function Getmillisecond () {list ($s 1, $s 2) = explode (", microtime ()); return (float) sprintf ('%.0f ', (Floatval ($s 1) + floatval ($s 2)) * 1000); Note that in a 32-bit system, the maximum size of PHP int is much less than the number of milliseconds, so you cannot use the int type, and PHP does not have a long type, so you have to use floating-point numbers to represent it. Because floating-point numbers are used, if the precision settings are not correct, the results obtained with the echo display may be incorrect, and to see the correct output, the precision setting cannot be less than 13 bits.