[thelist] PHP directory listing function

Burhan Khalid burhankhalid at members.evolt.org
Mon Dec 30 13:43:02 CST 2002

>Im trying to make a PHP script that grabs an array of all the filenames
>in a directory, strips the _ and .html and then creates links to these files...
>the last bits are fine its just how to actually grab the filenames in a dir
>when they are unknown that Im stuck with, any ideas??

Your in luck! I recently had to deal with a similar problem, and I sorted it out using the following script :

	 while ($file = readdir($handle))

All the files in the directory will now be in $result_array, and you can then do a string replace to strip the _ and .html

Best regards.
Burhan Khalid
burhankhalid at members.evolt.org

More information about the thelist mailing list