How to list all of the files in a directory and its subdirectories with php?

The recursive entries are put under index $filename while the direct contents are put under an ascending integer index, using Your loop will only show the integer indexes If you would print_r($array) you will see all entries. (Or you could replace $filename with of course.) To loop through them yourself, replace the while loop with foreach ( $array as $k=>$v ) { echo "$k: $v"; } (for the subdir, this will show "subdir: Array", but that's another topic; you could test is_array($v) and take some action based on that).

The recursive entries are put under index $filename, while the direct contents are put under an ascending integer index, using . Your loop will only show the integer indexes. If you would print_r($array); you will see all entries.

(Or you could replace $filename with , of course. ) To loop through them yourself, replace the while loop with foreach ( $array as $k=>$v ) { echo "$k: $v"; } (for the subdir, this will show "subdir: Array", but that's another topic; you could test is_array($v) and take some action based on that).

Ok great, thanks. Working perfectly now. – Baa Aug 11 '10 at 21:44.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions