Why are the two return methods of the microtime() function in PHP different in precision?
習慣沉默
習慣沉默 2017-05-24 11:33:37
0
1
446

Environment:
CentOS 7.3.1611
PHP 7.1.3

Code:

<?php
var_dump(microtime());
var_dump(microtime(true));

Output:

string(21) "0.23337700 1495449772"
float(1495449772.2334)

Question:
Run the code repeatedly and get the same result.
It is easy to understand that it is easy to understand to output an 8-digit millisecond value in the form of a string. Anyway, the last two digits are always 0. When output as a floating point number, the accuracy is controlled to four digits. What is the reason?

Additional verification:
Execute php -r "echo ini_get('precision'), PHP_EOL;"The output result is 14, which is obviously not about floating point in PHP The precision setting affects the output of microtime(). The "microtime" keyword is not found in php.ini. It seems that there are no special settings that affect the output accuracy.

I'm dizzy, and I'm looking forward to the expert's advice.

習慣沉默
習慣沉默

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!