note 62114 added to function.filesize

From: Date: Mon, 20 Feb 2006 14:03:09 +0000
Subject: note 62114 added to function.filesize
Groups: php.notes 
Request: Send a blank email to php-notes+get-104067@lists.php.net to get a copy of this message
a fix for mazaki at shaw dot ca's functions. The original function showed GB as MB, and MB as Kb and so on, so the fix is very simple, just remove the Bytes from the $units array <?php function human_size( $bytes, $decimal = '2' ) { if( is_numeric( $bytes ) ) { $position = 0; $units = array(" 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: 217.75.128.29 Probable Submitter: 84.242.180.201 ---- Manual Page -- http://www.php.net/manual/en/function.filesize.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+62114 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+62114&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+62114&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+62114&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+62114&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+62114&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+62114&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+62114&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+62114&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#104067) next »