View Single Post
Old 12-21-2005, 07:23 AM   #10 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,726
redhead is on a distinguished road
You have to split it up, and look at what is calculated within the expression ie:
Code:
($i = floor(log($size, 1024))))
$i is assigned the value for the 1024 logarithm to $size, meaning deciding how many times 1024 is logarithmic held in $size ie:
512 = 0 (1024^0), 1024 = 1 (1024^1), 1048576 = 2 (1024^2), 1073741824 = 3 (1024^3), etc.
Code:
. $filesizename[$i]
decides the appropriate extension given the value stored in $i fetched as the index found in $filesizename, from the previus ie:
0 = " Bytes", 1 = " KB", 2 = " MB", etc.
Code:
$size/pow(1024, ($i = floor(log($size, 1024)))), 2) == $size/pow(1024, $i, 2)
meaning it will give you the appropriate count of said 1024 is contained in your $size, ie:
$size = 512 yields $i = 0 yields pow(1024, 0, 2) = 1 yields $size/1 = 512, and filesizenames[$i] will provide you with "Bytes" so it will be "512 Bytes" it returnes.
$size = 1024 yields $i = 1 yields pow(1024, 1, 2) = 1024 yields $size/1024 = 1, and filesizenames[$i] will provide you with " KB" so it will be "1 KB" it returns
and so forth.

I hope this dosn't sound too complicated.
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote