I am trying to use a 64 bit hardcoded integer in a string variable.
Simplfied I want to do something like this:
$i = 76561197961384956;
$s = "i = $i";
This should result in s:
i = 76561197961384956
This obviously does not work, since PHP distinguishes large integers for float, therefore s:
i = 7.65611979614E+16
While some other methods, such as casting, etc., fail, I found number_format()and used it like this:
$s = "i = " . number_format($i, 0, '.', '');
But this leads to the fact that sit looks like:
i = 76561197961384960
It looks like an approximation problem, but how to fix it?
source
share