function byte_format($size=0, $units=['byte','KB','MB','GB','TB']): string
{
for ($i = 0; 1024 < $size; $i++) {
$size /= 1024;
}
return round($size) . ' ' . $units[$i];
}
これでどうでしょう?
More than 1 year has passed since last update.
function byte_format($size=0, $units=['byte','KB','MB','GB','TB']): string
{
for ($i = 0; 1024 < $size; $i++) {
$size /= 1024;
}
return round($size) . ' ' . $units[$i];
}
これでどうでしょう?
Register as a new user and use Qiita more conveniently