2023-12-26 11:16:24 +01:00
|
|
|
<?php
|
2023-12-28 12:26:35 +01:00
|
|
|
function ghs($b,$d=2) {
|
2023-12-26 11:16:24 +01:00
|
|
|
$o='';
|
2023-12-28 12:26:35 +01:00
|
|
|
$pib=1125899906842624;
|
|
|
|
$tib=1099511627776;
|
|
|
|
$gib=1073741824;
|
|
|
|
$mib=1048576;
|
|
|
|
$kib=1024;
|
|
|
|
if (round($b/$pib,1) >= 1)
|
|
|
|
$o=round($b/$pib,$d).' TiB';
|
|
|
|
elseif (round($b/$tib,1) >= 1)
|
|
|
|
$o=round($b/$tib,$d).' TiB';
|
|
|
|
elseif (round($b/$gib,1) >= 1)
|
|
|
|
$o=round($b/$gib,$d).' GiB';
|
|
|
|
elseif (round($b/$mib,1) >= 1)
|
|
|
|
$o=round($b/$mib,$d).' MiB';
|
|
|
|
elseif (round($b/$kib,1) >= 1)
|
|
|
|
$o=round($b/$kib,$d).' KiB';
|
|
|
|
else $o=$b.' B';
|
2023-12-26 11:16:24 +01:00
|
|
|
return($o);
|
|
|
|
}
|
|
|
|
?>
|