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);
    }
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);
    }
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 ) ; }
Returns a string representation of this number in the given base.

The output will always be lowercase for bases greater than 10.

@param int $base

@return string

@throws \InvalidArgumentException If the base is out of range.
Returns a string representation of this number in the given base .