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

Add Css And Js Files on Specific Page In laravel

Be 10x 10 tools from sessions

Diffrence between Put and Patch