Convert double to string in php

I have a simple question.

I have a number 7310093341976450848that I needed to echo. But when I echo, he gives me that 7.3100933419765E+18.

I tried

echo (string) $ data;
to pass it to a string and then print, but it still gives the same result.

The original number is of type double.

+5
source share
2 answers
I've this 7310093341976450848 number which I needed to echo.
The number is initially of type double.

Due to the floating point representation used in PHP, once it is saved as a double, you will no longer be able to print this exact number.

This is one of the (many) ways to print the value:

printf("%.0f", $data);
echo number_format($data, 0, '', '');

, : BC Math/GMP.

+5

number_format(). :

echo number_format( $data, 0, '', '' );
0