Just out of curiosity, how can you tell if a number x is a power of two (x = 2^n) without using recursion.
Thanks
The top answer:
($x & ($x - 1)) == 0
seemed to have issues with larger numbers for me, this works well for larger numbers using the same logic but with GMP:
gmp_strval(gmp_and($x, gmp_sub($x, 1))) == 0