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?
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.
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?
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.
精彩评论