note 98250 deleted from features.file-upload by danbrown

From: Date: Fri, 04 Jun 2010 00:16:13 +0000
Subject: note 98250 deleted from features.file-upload by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-169877@lists.php.net to get a copy of this message
Note Submitter: geoff at spacevs dot com ---- In reply to "info at levaravel dot com", that method would be inaccurate and slow, here is a much cleaner and faster implementation of the same functionality that rounds to two decimal points. <?PHP function GetHRSize($size) { $sizes = array('B', 'KiB', 'MiB', 'GiB', 'TiB'); while($size > 1024) { array_shift($sizes); $size *= 0.0009765625; /* mul is faster then div: 1.0 / 1024 */ } return number_format($size, 2) . array_shift($sizes); } ?>

« previous php.notes (#169877) next »