Questa funzione PHP converte i bytes in kilobytes e superiori!
< ?
function convert($b) {
# Perform Calculation
$kb = $b / 1024;
$mb = $kb / 1024;
$gb = $mb / 1024;
$tb = $gb / 1024;
$pb = $tb / 1024;
# Round As Necessary
if ($b > 1) {$s = round($b, 2) . "B";}
if ($kb > 1) {$s = round($kb, 2) . "KB";}
if ($mb > 1) {$s = round($mb, 2) . "MB";}
if ($gb > 1) {$s = round($gb, 2) . "GB";}
if ($tb > 1) {$s = round($tb, 2) . "GB";}
if ($pb > 1) {$s = round($pb, 2) . "PB";}
# Return Convert
return $s;
}
?>
fonte: www.sastgroup.com





