note 60141 added to function.filesize
| From: | php at arcannon dot com | Date: | Tue, 27 Dec 2005 21:38:30 +0000 |
| Subject: | note 60141 added to function.filesize | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-100817@lists.php.net to get a copy of this message | ||
itsacon version is great, except when the file size is zero. I added a short condition to check for
it.
function human_file_size($size) {
if($size == 0) {
return("0 Bytes");
}
$filesizename = array(" Bytes", " KB", " MB", " GB", "
TB", " PB", " EB", " ZB", " YB");
return round($size/pow(1024, ($i = floor(log($size, 1024)))), 2) . $filesizename[$i];
}
----
Manual Page -- http://www.php.net/manual/en/function.filesize.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+60141
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60141&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60141&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60141&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60141&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60141&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60141&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60141&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+60141&report=yes
Search -- http://master.php.net/manage/user-notes.php