< ?php
function human_size($size) {
$units = array('B','KB','MB','GB');
for ($i = 0; $size > 1024; $i++) {
$size /= 1024;
}
return round($size, 2).' '.$units[$i];
}
?>
PHP – Human size format
Leave a reply
< ?php
function human_size($size) {
$units = array('B','KB','MB','GB');
for ($i = 0; $size > 1024; $i++) {
$size /= 1024;
}
return round($size, 2).' '.$units[$i];
}
?>