// will output i.e. 1KB (function always accepts bytes value)
echo convert(1024);
function convert($size)
{
$unit=array('b','kb','mb','gb','tb','pb');
return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i];
}
Get peak memory usage: die(var_dump(convert(memory_get_peak_usage(true))));
Next > |
---|