Get All files of a folder in php or specific extension files

By PHP inbuild function glob()

Return an array of filenames or directories that matches the specified pattern:

 <?php

print_r(glob("test/*.txt"));

Output:-

Array (

  [0] => target.txt

  [1] => source.txt

  [2] => test.txt

  [3] => test2.txt

)

?>

Comments

Popular posts from this blog

Import csv file in laravel

Remove css or js version wordpress

Mysql Subquery