Is there any function that when given a directory name as its argument, returns an array containing the names of all the files in that directory, or all the directories in that directory, or both (as a multi-d array, I'd expect)? I assume such a function could be used on the directory the php program running it is contained in, yes? (If yes, please be clear on how.)
I need this because I'm writing some custom index pages ("index.php") that will get installed into automatically created directories when the directory is created; each time the index is opened, I want ti to look at the directory contents and create a list of some or all of the files / directories. So if I had all the files and / or directories in an array, I could check and see if its name matches the format for the ones I want to show people, and add it to a list to be displayed as part of the directories custom created index.
Also, is there any way to check how many files a directory contains? This would be handy because when I'd like to put that number next to the link to the directory in my index.
Edit- Hmm, looks like this is what scandir is made for. Yep, easy to get the names of everything, and checking the length of the array would give me the number of files. OK, answered my own question, but if anybody has some pointers, feel free to chip in with advice.