function BigInteger::toBase
Returns a string representation of this number in the given base.
The output will always be lowercase for bases greater than 10.
Throws
\InvalidArgumentException If the base is out of range.
1 call to BigInteger::toBase()
- BigInteger::getBitLength in vendor/
brick/ math/ src/ BigInteger.php - Returns the number of bits in the minimal two's-complement representation of this BigInteger, excluding a sign bit.
File
-
vendor/
brick/ math/ src/ BigInteger.php, line 918
Class
- BigInteger
- An arbitrary-size integer.
Namespace
Brick\MathCode
public function toBase(int $base) : string {
if ($base === 10) {
return $this->value;
}
if ($base < 2 || $base > 36) {
throw new \InvalidArgumentException(\sprintf('Base %d is out of range [2, 36]', $base));
}
return Calculator::get()->toBase($this->value, $base);
}