HTMLを綺麗に、色んなテスト関係関数の修正

This commit is contained in:
2025-11-20 22:39:28 +09:00
parent 8513c530f5
commit 4f70e6d4e4
11 changed files with 145 additions and 71 deletions

View File

@@ -61,3 +61,33 @@ function logger(LogType $section, mixed $arg): void {
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);
}
}