문제

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top