I actually have it done, I did this math equation about 2 years ago and I am having trouble understanding it now.
Basicly I use this so that when users upload photos to my site, I can balance them out with only X amount of photo per folder.
This gives me something like this 1/1 1/2 1/3 1/4 ----1/10 2/1 2/2 2/3 and so on but I need to modify it to go 3 folders deep, each folder should have a limit of the number 1-9 or 1-10 then it will increase that number to the next
So if a large enough number is entered into my function below and the result is 3/10 then when the right number of objects is reached it would bump up to 4/1 then when so many thousands objects go by again it will jump to 4/2. What I am wanting to do is make it 3 numbers/levels deep 3/10/2 would go to 3/10/3 when it got to 3/10/10 it would go 4/1/1 4/1/2 4/1/3 when the third place got to 10 it would make it got to 4/2/1
<?PHP
function uploadfolder($x) {
$dir = floor($x/18001) + 1;
$sdir = ceil($x/2000) % 9;
return "$dir/$sdir";
}
?>
I spent a lot of time 2 years ago to get it to do this with 2 levels deep and I just kind of got lucky and now it is somewhat confusing for me looking back at it