Hey all, here's my question...
I need to have a portion of a script read the contents of a directory and extract only the names of subdirectories. Once extracted, I need those names put into an array I can iterate through later to populate a drop-down menu. The reason for this is that the current hosting plan does not have any MySQL databases (not my doing) and the amount of subdirectories changes once another script either creates or destroys a directory.
TIA!
See [man]glob/man using the GLOB_ONLYDIR parameter.
$dir = "name of directory here"; $dirs = glob($dir . '/*', GLOB_ONLYDIR);
foreach($dirs as $dir) { $folders[] = $dir; }
Now the $folders array has the subdirectories in a numbered array. REmember that arrays start at 0, not 1.
Thanks all! Worked great, just had to add some additional work to trim off the path and it's rockin'!
deleted.