Created
July 6, 2018 21:32
-
-
Save grvoyt/fddd164c5f87843420b3cb2ec83bc7ff 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
function bytes($a) { | |
$unim = array("B","KB","MB","GB","TB","PB"); | |
$c = 0; | |
while ($a>=1024) { | |
$c++; | |
$a = $a/1024; | |
} | |
return number_format($a,($c ? 2 : 0),",",".")." ".$unim[$c]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment