note 61166 added to function.filesize

From: Date: Fri, 27 Jan 2006 04:54:24 +0000
Subject: note 61166 added to function.filesize
Groups: php.notes 
Request: Send a blank email to php-notes+get-102529@lists.php.net to get a copy of this message
I've been reading through most of the human readable file size functions and most do the trick, here is my version. <?php function human_size( $bytes, $decimal = '2' ) { if( is_numeric( $bytes ) ) { $position = 0; $units = array( " Bytes", " KB", " MB", " GB", " TB" ); while( $bytes >= 1024 && ( $bytes / 1024 ) >= 1 ) { $bytes /= 1024; $position++; } return round( $bytes, $decimal ) . $units[$position]; } else { return "0 Bytes"; } } ?> ---- Server IP: 216.235.15.211 Probable Submitter: 24.67.129.18 ---- Manual Page -- http://www.php.net/manual/en/function.filesize.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+61166 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61166&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61166&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61166&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61166&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61166&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61166&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61166&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+61166&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#102529) next »