-1

Hello i need to know if php there is a variable type that doesn't show me something like this:

3.9614081257132E+28

Please anyone knows how to make that?

3 Answers3

3

Try printf() to print the variable:

echo sprintf("%f", 3.9614081257132E+28);
// prints 39614081257132001671004553216.00000

Or without the decimal digits:

echo sprintf("%.0f", 3.9614081257132E+28);
// prints 39614081257132001671004553216

If you need arbitrary precision numbers, try the bcmath and GMP modules.

Arnaud Le Blanc
  • 98,321
  • 23
  • 206
  • 194
0

What you get is just a standard way of displaying "long" real numbers.

for operations with those, you might also want to review this topic: How to parse long value in php?

Community
  • 1
  • 1
jancha
  • 4,916
  • 1
  • 24
  • 39
0

There are no "big num" types in PHP. However, there really isn't anything to stop you from building a class that is capable of representing a big integer. You can do this with the string data type.

Man Vs Code
  • 1,058
  • 10
  • 14