Created
October 21, 2014 16:03
-
-
Save vukicevic/5ec5f0bdad58f5d05fa1 to your computer and use it in GitHub Desktop.
Human-readable file size from bytes.
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
function readable($size, $unit = array('B', 'KB', 'MB', 'GB', 'TB', 'PB')) { | |
return ($size > 1024) ? readable($size/1024, array_slice($unit, 1)) : round($size, 2) . ' ' . array_shift($unit); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment