Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to work with big numbers in PHP?

Tags:

php

biginteger

How to work with big numbers in PHP?

such as

(6*27^0+17*27^1+11*27^2+18*27^3+25*27^4+4*27^5)^65537
like image 314
Pentium10 Avatar asked Mar 22 '10 08:03

Pentium10


People also ask

How do I echo an integer in PHP?

echo (int) ( (0.1+0.7) * 10 ); // echoes 7!

How many digits are in a number in PHP?

PHP Floats The float data type can commonly store a value up to 1.7976931348623E+308 (platform dependent), and have a maximum precision of 14 digits.

Can PHP calculate?

PHP is able to perform complex calculations quickly and provides many more tools to write whichever calculations are needed. Exponents, percentage, square root, and many more operations are possible.

Is 0 an integer in PHP?

PHP converts the string to an int, which is 0 (as it doesn't contain any number representation).


1 Answers

You can go for BCMath to work with big numbers.

like image 192
Sarfraz Avatar answered Nov 10 '22 22:11

Sarfraz