Return to Snippet

Revision: 76807
at July 29, 2019 16:35 by martinbrait


Initial Code
<?php
//The second example shows how to retrieve only the files 
//contained in a given path.

$filelist = array();
if ($handle = opendir(".")) {
    while ($entry = readdir($handle)) {
        if (is_file($entry)) {
            $filelist[] = $entry;
        }
    }
    closedir($handle);
	
}
print_r ($filelist);
?>

Initial URL


Initial Description
php list all files of a given directory

Initial Title
Lister tous fichiers contenus dans un dossier

Initial Tags
list, array, files

Initial Language
PHP