Created
June 4, 2014 18:21
-
-
Save taichunmin/88e4cc849f668bdd27e2 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
<?php | |
/* | |
2012/04/21 taichunmin | |
將檔案大小顯示成為比較好讀的方式 | |
*/ | |
function tai_readableFileSize($size) | |
{ | |
$unit = array('Byte','KB','MB','GB','TB','PB'); | |
$ia = 0; | |
while($size>1000) | |
{ | |
$size/=1024; | |
$ia++; | |
} | |
return sprintf("%.1f ",$size).$unit[$ia]; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment