Created
April 16, 2016 12:43
-
-
Save fribibb/47bb9a41df00dbfff8c93ca8c2e14941 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// from https://gist.github.com/jameschens | |
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]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment