Looking at files within a folder...

.
..
log1.log
log2.log
file2.txt
file1.txt

 

<?php
    $handle = opendir('./sub');
    while(false !== ($file = readdir($handle))){
        echo "$file<br />";
    }
    closedir($handle);
?>