note 88053 added to function.filesize

From: Date: Wed, 07 Jan 2009 23:46:49 +0000
Subject: note 88053 added to function.filesize
Groups: php.notes 
Request: Send a blank email to php-notes+get-148931@lists.php.net to get a copy of this message
Hi, this is my very fast version of byteConvert(). Without using costly pow() function. <?php /** * Byte converting with bitshifting and formated number * * @param int $bytes bytes * @return string */ function byteConvert(&$bytes){ $con = 1024; $b = (int)$bytes; $s = array('B', 'kB', 'MB', 'GB', 'TB'); $e = (int)(log($b,$con)); return number_format($b/($con<<$e)*2,2,',','.').' '.$s[$e]; } ?> ---- Server IP: 217.13.201.10 Probable Submitter: 77.176.230.4 ---- Manual Page -- http://www.php.net/manual/en/function.filesize.php Edit -- https://master.php.net/note/edit/88053 Del: integrated -- https://master.php.net/note/delete/88053/integrated Del: useless -- https://master.php.net/note/delete/88053/useless Del: bad code -- https://master.php.net/note/delete/88053/bad+code Del: spam -- https://master.php.net/note/delete/88053/spam Del: non-english -- https://master.php.net/note/delete/88053/non-english Del: in docs -- https://master.php.net/note/delete/88053/in+docs Del: other reasons-- https://master.php.net/note/delete/88053 Reject -- https://master.php.net/note/reject/88053 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#148931) next »