note 9359 deleted from function.filesize by jimw

From: Date: Wed, 02 Jan 2002 01:47:30 +0000
Subject: note 9359 deleted from function.filesize by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-24111@lists.php.net to get a copy of this message
Here is a more compact way to accomplish converting file size to B, KB, MB, GB, TB as presented by jesse@jess.on.ca below. $j = 0; $ext = array("B","KB","MB","GB","TB"); $file_size = filesize(<FILENAME>); while ($file_size >= pow(1024,$j)) ++$j; $file_size = round($file_size / pow(1024,$j-1) * 100) / 100 . $ext[$j-1];

« previous php.notes (#24111) next »