RsD0p9BK
9/2/2016 - 4:01 AM

file__size.php

# Human Readable File Size with PHP

function human_filesize($size, $precision = 2) {
    for($i = 0; ($size / 1024) > 0.9; $i++, $size /= 1024) {}
    return round($size, $precision).['B','kB','MB','GB','TB','PB','EB','ZB','YB'][$i];
}

# https://gist.github.com/liunian/9338301