Based on @FrederikSpang comment
You can set precision
setting in php.ini
file. It should be greater than yours(14)
For ex my ini setting is 16
:
precision = 16
题
I'm working with an API which calculates a timestamp using the following function:
public function timestamp() {
return round(microtime(TRUE) * 1000);
}
But when i call the function on my localhost and on my webhost, i get the following in return:
1.37872612307E+12
But if i get other people to run the same code on their server(and using http://writecodeonline.com/php/), i get the following, and correct timestamp back:
1378726142452
But why?
Running XAMPP on OSX, and on unoeuro.com webhost.
解决方案
Based on @FrederikSpang comment
You can set precision
setting in php.ini
file. It should be greater than yours(14)
For ex my ini setting is 16
:
precision = 16
其他提示
Check precision
setting in your php.ini
.
See how different values influence on output of your function: http://ideone.com/9MMLvD