Looking at files within a folder...

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

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