/** * Converts the provided number from base to another. * * This method provides a convenient replacement to PHP's built in * `base_convert()`. The number bases are simply passed along to the * constructor, which means they can be instances of NumberBase class or * constructor parameters for that class. * * Note that due to the way the constructor parameters for NumberBase work, * this method can be used exactly the same way as `base_convert()`. * * @param string $number The number to convert * @param mixed $fromBase Number base used by the provided number * @param mixed $toBase Number base used by the returned number * @param int $precision Precision for inaccurate conversion * @return string|false The converted number or false on error */ public static function baseConvert($number, $fromBase, $toBase, $precision = -1) { $converter = new self($fromBase, $toBase); $converter->setPrecision($precision); return $converter->convert($number); }