PDA

View Full Version : Need big integer in PHP



Daniel Hollands
April 3rd, 2001, 14:44
The site I'm working on at the moment which uses a lot of numbers to access data from a MySQL table.

Due to the nature of the site, it will require large numbers very quickly, however these revert to "scientific notation" when stored as variables.

I used the settype function to set the variables to integers, but the largest number I can have with this is 2147483647 which is still not large enough.

I tried using double or string with the settype function, but this just caused the scientific notation problem again.

any suggestions?

razor
April 3rd, 2001, 15:37
why dont you switch all the numbers to letters and convert them to numbers when they have to be displayed. ex:
a=1
b=2

abbaa= 12211

will something like that work?

Daniel Hollands
April 3rd, 2001, 15:51
Good idea, but i think in the context of my site, it would not work. :(

Woofcat
April 3rd, 2001, 19:34
That's what the bcmath functions are for.

Also, what version of PHP are you using? I think 4.0.4+ lets you use 64-bit integers without bcmath...