html { color: #fcfcfc; background-color: #232023; } body { margin: 0; }';
echo '
';
print_r($arg);
echo '';
die();
}
function base58btc_encode(string $bin): string {
$a = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
$base = 58;
$num = \gmp_import($bin, 1, GMP_LSW_FIRST | GMP_NATIVE_ENDIAN);
$res = '';
if (\gmp_cmp($num, 0) == 0) return '1';
while (\gmp_cmp($num, 0) > 0) {
$mod = \gmp_intval(\gmp_mod($num, $base));
$res = $a[$mod].$res;
$num = \gmp_div_q($num, $base);
}
$bytes = str_split($bin);
foreach ($bytes as $byte) {
if (ord($byte) === 0) {
$res = '1'.$res;
} else {
break;
}
}
return $res;
}
function logger(LogType $section, mixed $arg): void {
if (LOGGING_ENABLED) {
$logfile = ROOT.'/log/';
if ($section == LogType::ActivityPub) $logfile .= 'ap_log.txt';
else if ($section == LogType::Mailer) $logfile .= 'mail_log.txt';
else if ($section == LogType::MySQL) $logfile .= 'mysql_log.txt';
else if ($section == LogType::Csv) $logfile .= 'csv_log.txt';
file_put_contents($logfile, $arg."\n", FILE_APPEND);
}
}
function to_money($amount, $lang) {
$amount = floatval($amount);
switch (strtolower($lang)) {
case 'ja':
if ($amount >= 100000000) {
$oku = $amount / 100000000;
return $oku.'億円';
} else if ($amount >= 10000) {
$man = $amount / 10000;
return $man.'万円';
}
return number_format($amount, 0).'円';
case 'en':
if ($amount >= 1000000000) {
$billion = $amount / 1000000000;
return '¥ '.$billion.' billion';
} else if ($amount >= 1000000) {
$million = $amount / 1000000;
return '¥ '.$million.' million';
} else if ($amount >= 1000) {
$thousand = $amount / 1000;
return '¥ '.$thousand.' thousand';
}
return '¥ '.number_format($amount, 0);
default:
return '¥ '.number_format($amount, 0);
}
}