I'm trying to use a hardcoded 64bit integer in a string variable.
Simplfied I want to do something like this:
$i = 76561197961384956;
$s = "i = $i";
Which should result in s
being:
i = 76561197961384956
This does obviously not work as PHP cast big integers to float, therefore s
is:
i = 7.65611979614E+16
While several other methods like casting etc. fail, I found number_format()
and use it like this:
$s = "i = " . number_format($i, 0, '.', '');
But this results in s
being:
i = 76561197961384960
Looks like an approximation problem, but how to fix this?