Php Get All Txt Files In Directory

[Solved] Php Get All Txt Files In Directory | Php - Code Explorer | yomemimo.com
Question : php get all txt files in directory

Answered by : tomatentim

$path = '/path/to/directory';
$files = glob($path."/*.txt");
foreach ($files as $file) { echo $file; echo '<br>';
}
/* Outputs something like:	/path/to/directory/someFile.txt	/path/to/directory/someOtherFile.txt	/path/to/directory/anotherFile.txt
*/

Source : | Last Update : Sat, 31 Jul 21

Answers related to php get all txt files in directory

Code Explorer Popular Question For Php