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];
}
これでどうでしょう?
Go to list of users who liked
More than 3 years have 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
Go to list of users who liked