I’ve a simple question.
I’ve this 7310093341976450848 number which I needed to echo.But when I echo it gives me this 7.3100933419765E+18.
I tried
echo (string)$data;
to cast it to string and then print it but it’s still giving the same result.
The number is initially of type double.
Because of the floating point representation used in PHP, once it’s stored as a double, you cannot print out that exact number anymore.
This is one of the (many) ways to print out the value:
If you don’t want to lose precision, store it as a string, or use one of the arbitrary precision libraries: BC Math / GMP.