note 105586 deleted from function.filesize by aharvey

From: Date: Tue, 22 Jan 2013 00:18:02 +0000
Subject: note 105586 deleted from function.filesize by aharvey
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-193312@lists.php.net to get a copy of this message
Note Submitter: stachu540 at gmail dot com ---- That is for example how getting filesize with bytes ending. <?php function FileSize($file, $setup = null) { $FZ = ($file && @is_file($file)) ? filesize($file) : NULL; $FS = array("B","kB","MB","GB","TB","PB","EB","ZB","YB"); if(!$setup && $setup !== 0) { return number_format($FZ/pow(1024, $I=floor(log($FZ, 1024))), ($i >= 1) ? 2 : 0) . ' ' . $FS[$I]; } elseif ($setup == 'INT') return number_format($FZ); else return number_format($FZ/pow(1024, $setup), ($setup >= 1) ? 2 : 0 ). ' ' . $FS[$setup]; } ?>

« previous php.notes (#193312) next »