Posted by Chung Leong on 12/20/05 17:06
You could, of course, just do it arithmatically: function byteConversion($bytes) { $units = array('byte(s)', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'); $unit_index = ($bytes) ? floor(log($bytes) / log(2) / 10) : 0; $size = round($bytes / pow(2, $unit_index * 10), 2); return "$size {$units[$unit_index]}"; }
[Back to original message]
Copyright © 2005-2006 Powered by Custom PHP Programming