Environment:
CentOS 7.3.1611
PHP 7.1.3
Code:
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:
Executephp -r "echo ini_get('precision'), PHP_EOL;"
The output result is14
, 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.
ini_get('precision')
A control accuracy of 14 means:float(1495449772.2334) has 14 digits in total, 10 digits before the decimal point and 4 digits after the decimal point. It does not mean 14 digits after the decimal point.
Let’s take a look at the results of the facet code.