How to store huge numbers in PHP
I need to convert a number from 36-th base into an integer. The original number length is about 10 characters which seem to be bigger then PHP's limits 开发者_Python百科for integers.
In my case the original number looks like this: 9F02tq977
. When converted I get the following result 8.46332972237E+12
.
How can I store huge numbers in PHP?
Since BC Math doesn't work with arbitrary base numbers, you could try using GMP functions if you have them available.
http://www.php.net/manual/en/ref.gmp.php
Otherwise you'll probably have to rewrite your algorithm and write your own arbitrary precision arithemtic implementation of the validation algorithm.
Use a math library like BC Math for big numbers :)
http://be2.php.net/manual/en/book.bc.php
精彩评论