.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   General Programming (http://forums.bots-united.com/forumdisplay.php?f=25)
-   -   Easy Size Conv. Func. (http://forums.bots-united.com/showthread.php?t=6463)

Ancient 18-08-2007 00:55

Easy Size Conv. Func.
 
Nice and nifty little script to change sizes to recognizable ones.

PHP Code:

function size_convert($size)
 {
  
$i=0;
  
$iec = array(" B"" KB"" MB"" GB");
  while ((
$size/1024)>=1
   {
    
$size=$size/1024;
    
$i++;
   }
  return 
substr($size,0,strpos($size,'.')+3).$iec[$i];
 }
 
$size file_size('/' 'home' '/' 'blah' '/' 'public_html' '/' $_SESSION['folder'] . '/');
$size size_convert($size);
 
echo 
$size

Figured it would be good for file manipulation scripts and such.


All times are GMT +2. The time now is 03:19.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.