HTMLを綺麗に、色んなテスト関係関数の修正
This commit is contained in:
30
util.php
30
util.php
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user