php get names of files in directory code example
Example 1: php get all php files in a directory
foreach(glob('includes/*.php') as $file) {
...
}
Example 2: php list directories
$dir = '.';
$directories = glob($dir . '/*', GLOB_ONLYDIR);
foreach(glob('includes/*.php') as $file) {
...
}
$dir = '.';
$directories = glob($dir . '/*', GLOB_ONLYDIR);