# Arbitrary-length base conversion in PHP

After some digging, I found a great way to convert number bases when dealing with arbitrary length integers (esp. integers > 32 bits):

`return gmp_strval(gmp_init($n, 2), 10);`

This will convert a large base 2 (binary) number to base 10 (decimal).

Written on September 4, 2009