1$path = '/path/to/directory';
2$files = glob($path."/*.txt");
3foreach ($files as $file) {
4 echo $file;
5 echo '<br>';
6}
7/* Outputs something like:
8 /path/to/directory/someFile.txt
9 /path/to/directory/someOtherFile.txt
10 /path/to/directory/anotherFile.txt
11*/