开发者

php variables help with a big number [closed]

开发者 https://www.devze.com 2023-04-03 03:36 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be开发者_JAVA百科 reopened, visit the help center. Closed 9 years ago.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消