note 57187 deleted from function.disk-free-space by aidan
| From: | aidan@php.net | Date: | Thu, 16 Nov 2006 02:30:04 +0000 |
| Subject: | note 57187 deleted from function.disk-free-space by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-119790@lists.php.net to get a copy of this message | ||
Note Submitter: ludvig dot ericson at gmail dot com
----
On the first note by aidan: it does not work.
On the second note, this is better:
<?
function readable_size($size) {
if ($size < 1024) {
return $size . ' B';
}
$units = array("kB", "MiB", "GB", "TB");
foreach ($units as $unit) {
$size = size / 1024;
if ($size / 1024 > 1024) {
break;
}
return $size . ' ' . $unit;
}
?>