note 48516 added to function.filesize

From: Date: Tue, 28 Dec 2004 00:15:02 +0000
Subject: note 48516 added to function.filesize
Groups: php.notes 
Request: Send a blank email to php-notes+get-82380@lists.php.net to get a copy of this message
Nice neat little function I wrote up that gives you size values in a more understandable way, forexample, 0.98Gb as opposed to 980Mb. It allowes for values slightly smaller than the acctual threshold. function sizeing($bytes) { if (round($bytes / 1000000000000000,2) >= 1) { return round(($bytes / (1099511627776 * 1024)),2) .'Pb'; } if (round($bytes / 1000000000000,2) >= 1) { return round(($bytes / 1099511627776),2) .'Tb'; } if (round($bytes / 1000000000,2) >= 1) { return round(($bytes / 1073741824),2). 'Gb'; } if (round($bytes / 1000000,1) >= 1) { return round(($bytes / 1048576),1).'Mb'; } if (round($bytes / 1000,1) >= 1) { return round(($bytes / 1024),1) .'kb'; } return (int)($bytes) .'b'; } ---- Manual Page -- http://www.php.net/manual/en/function.filesize.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+48516 Delete -- http://master.php.net/manage/user-notes.php?action=delete+48516&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48516&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48516&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48516&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48516&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48516&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+48516&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#82380) next »