.:: Bots United ::.  
filebase forums irc server wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps waypoints yapb

Go Back   .:: Bots United ::. > Developer's Farm > General Programming
General Programming Help others and get yourself helped here!

Reply
 
Thread Tools
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. - 18-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
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com