Ok, so PHP isn\'t the best language to be dealing with arbitrarily large integers in, considering that it only natively supports 32-bit signed integers. What I\'m trying to
The PHP GMP extension will be better for this. As an added bonus, you can use it to do your decimal-to-binary conversion, like so:
gmp_strval(gmp_init($n, 10), 2);