function baseConvert(string $number, int $fromBase, int $toBase) {
$chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_';
if ($fromBase == 10) {
$int = $number;
} else {
$int = 0;
$len = strlen($number);
$numberRev = strrev($number);
for ($i = 0; $i < $len; $i++) {
$int = gmp_add($int, gmp_mul($chars[strpos($chars, $numberRev[$i])], gmp_pow($fromBase, $i)));
}
}
$converted = '';
while (gmp_cmp($int, 0) > 0) {
list ($int, $remainder) = gmp_div_qr($int, $toBase);
$converted = $chars[gmp_intval($remainder)] . $converted;
}
return $converted;
}