Staredit Network

Staredit Network -> Computers and Technical -> Questions
Report, edit, etc...Posted by O)FaRTy1billion on 2006-06-08 at 22:19:25
Just because its easier to just post here and hope someone answers, I am going to post here then try and look them up after I type all this. It helps organize what I am looking for, and it overlaps my search with waiting for posts.

What I am doing is making a script to read some folders and files, and I just have a few questions along the way.
/../ is parent directory, correct? Well what is /./?
This reads in whatever order, but I want directories to be before the files and them all to be alphabetized. Is it possable to make an array without a specific size? Or do I just have to make an array with some big number of entries. And then can I alphabetize the values in the array? Or do I just have to live with the order it has them in?

k time to look these up and wait for answers. wink.gif
Report, edit, etc...Posted by Shmeeps on 2006-06-08 at 23:01:44
./ I believe is the current directory. Not sure though/

Array without a specific size, just initialize it with $array['0'];. If you need more, just do $array['1'], 2, 3, ect.

You can alphebetize an array, but I don't remember how. It has to do with going through the array in a loop and pulling out all the values, alphabetize them in there, and then resetting the values back in the array.
Report, edit, etc...Posted by O)FaRTy1billion on 2006-06-08 at 23:28:26
I got most of it..
sort(); won't alphabetize the files though.. <:C

ADDITION:
K I got it sorted but its case-sensitive.. hmm. I need to find a way around that.

ADDITION:
yay! ok I got it all.

I will leave this open because it is nice to not have to make 3000 PHP help topics.
Report, edit, etc...Posted by RexyRex on 2006-06-10 at 18:06:51
Parent directory is:
CODE
dirname(dirname(__FILE__));

And the current directory is getcwd(). showoff.gif

Hmm...try:
CODE
sort($array,SORT_STRING);
Report, edit, etc...Posted by O)FaRTy1billion on 2006-06-11 at 14:11:23
Wah..? I exploded it into an array, did $ajajaja = array_pop($newdir); twice, and then imploded. boxed.gif

SORT_STRING didn't like that some/all of the file strings had a "." in them.
Report, edit, etc...Posted by RexyRex on 2006-06-11 at 15:53:52
That's a lot of unessecary work and probably raises the execution time. The first code I posted does the same thing. Just assign that to a variable.

smile.gif

Enjoy.
Next Page (1)