Try this,
string readdir (int dir_handle).
Returns the filename of the next file from the directory. The filenames are not returned in any particular order.
Note that readdir() will return the . and .. entries. If you don’t want these, simply strip them out:
Example.
List all files in the current directory and strip out . and ..
<?php
$handle=opendir(’.’);
while (false!==($file = readdir($handle))) {
if ($file != "." && $file != "..") {
echo "$file\n";
}
}
closedir($handle);
?>
Bye.