<?php
/**
* @author: Jörg Reinholz, fastix WebDesign & Consult, Kassel - http://www.fastix.org/
* @return string Rounded human readable Integers (E ~ exbi ... G ~ gibi ... K ~ kibi)
* @param string $s will be a float
* @param integer $p - decimals in return, Default: 2
* @param string $e - A Stringm given back after eg. the "B" in KB, Default: B
**/
function humanReadableBin ($s, $p=2, $e='B') {
if ($f >= 1152921504606846976) {
return ( round( ( $f / 1152921504606846976 ) , $p) . ' E' . $e );
} elseif ($f >= 1125899906842624) {
return ( round( ( $f / 1125899906842624 ) , $p) . ' P' . $e );
} elseif ($f >= 1099511627776) {
return ( round( ( $f / 1099511627776 ) , $p) . ' T' . $e );
} elseif ($f >= 1073741824) {
return ( round( ($f / 1073741824 ) , $p) . ' G' . $e );
} elseif ($f >= 1048576) {
return ( round( ( $f / 1048576 ) , $p) . ' M' . $e );
} elseif ($f >= 1024) {
return (round( ( $f / 1024 ) , $p) . ' K' . $e );
} else {
return $f . ' '. $e;
}
}