How to print all filenames from a directory in PHP

1 Answer

0 votes
/*
array glob( string $pattern [, int $flags = 0 ] )
*/  
  
echo "<pre>";
print_r(glob("e:/*.*"));
echo "</pre>";


/*
run:
  
Array
(
    [1] => e:/$RECYCLE.BIN
    [8] => e:/IMG_1803.JPG
    [15] => e:/backup.txt
    [16] => e:/byte.bin
    [20] => e:/counter.js
    [30] => e:/db.xml
    [31] => e:/error_log.txt
    [32] => e:/file.bin
    [37] => e:/footer.html
)

*/

 



answered Dec 16, 2015 by avibootz
...