Topic awaiting preservation: listing files in directory - PHP |
|
---|---|
Author | Thread |
Maniac (V) Inmate From: there...no..there..... |
posted 09-06-2008 20:31
I have this snippet of code working so far but need something else : code: if ($handle = opendir($dir)) { $filecount = "0"; while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $file = strtolower($file); $fileList[] = trim($file); $filecount = $filecount + 1; } } print 'File Count: <b>'.$filecount.'</b><br>'; sort ($fileList); reset ($fileList); while (list ($key, $val) = each ($fileList)) { echo $val.'<br>'; } closedir($handle); }
|
Maniac (V) Inmate From: there...no..there..... |
posted 09-06-2008 20:58
eigh...I got it. It's the $key in the while loop that I needed |