View Single Post
Easy Size Conv. Func.
Old
  (#1)
Ancient
PodBot MM's Laziest Waypointer
 
Ancient's Avatar
 
Status: Offline
Posts: 1,010
Join Date: Jan 2005
Location: Nebraska, United States of America
Default Easy Size Conv. Func. - 17-08-2007

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.


[Web Designer][Waypointer][Gamer]
CFE Games Administrator
[CFE]Games.com
[Never Trust the Untrusted]
  
Reply With Quote