note 86999 deleted from function.filesize by danbrown

From: Date: Fri, 14 Nov 2008 14:06:40 +0000
Subject: note 86999 deleted from function.filesize by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-146524@lists.php.net to get a copy of this message
Note Submitter: osmankhalid2005 at yahoo dot com ---- I developed a very easy to use and bug free function to convert bytes in other units. My MS in Computer Engineering helped in devising this solution. //////////////////////////////////////////// function GetFileSize($size) { $unit=""; if($size >=0 && $size < 1024) { $unit = " Bytes"; } elseif($size >=1024 && $size < 1048576) { $size = round($size / 1024, 2); $unit = " KB"; } elseif($size >=1048576 && $size < 1073741824) { $size = round($size / 1048576, 2); $unit = " MB"; } elseif($size >=1073741824 && $size < 1099511627776) { $size = round($size / 1073741824, 2); $unit = " GB"; } return $size . $unit; } //===================================================================

« previous php.notes (#146524) next »