\PHP
file_size_fmat.txt
This function formats a size in bytes to anything in the range of KB, Mb, GB, and Tb. Example: echo size_format(filesize(".")); Questions, Contact JoshS@santsys.com function size_format($size) { $size /= 1024; if($size < 1024) { $size = number_format($size, 2); $size .= "kb"; } else { if(($size / 1024) < 1024) { $size = number_format($size / 1024, 2); $size .= 'mb'; } elseif($size / 1024 / 1024 < 1024) { $size = number_format($size / 1024 / 1024, 2); $size .= 'gb'; } else { $size = number_format($size / 1024 / 1024 / 1024, 2); $size .= 'tb'; } } return $size; }