note 82019 added to function.filesize

From: Date: Tue, 25 Mar 2008 02:01:58 +0000
Subject: note 82019 added to function.filesize
Groups: php.notes 
Request: Send a blank email to php-notes+get-137537@lists.php.net to get a copy of this message
Just a small bit added in-case someone doesn't want it to go up to 'TB' and deletes 'TB' onwards but the file size is larger than 1024GB this checks to see if you have outreached the size of $sizes <?php function format_size($size, $round = 0) { //Size must be bytes! $sizes = array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'); for ($i=0; $size > 1024 && $i < count($sizes); $i++) $size /= 1024; return round($size,$round).$sizes[$i]; } ?> ---- Server IP: 92.48.74.199 Probable Submitter: 92.8.139.225 ---- Manual Page -- http://www.php.net/manual/en/function.filesize.php Edit -- https://master.php.net/note/edit/82019 Del: integrated -- https://master.php.net/note/delete/82019/integrated Del: useless -- https://master.php.net/note/delete/82019/useless Del: bad code -- https://master.php.net/note/delete/82019/bad+code Del: spam -- https://master.php.net/note/delete/82019/spam Del: non-english -- https://master.php.net/note/delete/82019/non-english Del: in docs -- https://master.php.net/note/delete/82019/in+docs Del: other reasons-- https://master.php.net/note/delete/82019 Reject -- https://master.php.net/note/reject/82019 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#137537) next »