someone answered me before, but i cant seem to find it in the search...
for do i make a foreach in PHP, opens up a DIR, and lists the files in an array?
I know how to list the lines of a text file, but not the contents of a directory. Thanks a lot.
$handle=opendir('.'); while ($file = readdir($handle)) { if ($file != "." && $file != "..") { echo "$file\n"; } } closedir($handle);
seems to work.. thanks anyway
this doesnt work with an array.. guess i need some help after all...
Just instead of outputting it, store it in an array:
$dirs = array(); $handle=opendir('.'); while ($file = readdir($handle)) { if ($file != "." && $file != "..") { $dirs[] = $file; } } closedir($handle);
Diego