Adrian M. Adrian M. - 1 year ago 131
PHP Question

PHP Get all subdirectories of a given directory

How can I get all sub-directories of a given directory without files,

(current directory) or
(parent directory)
and then use each directory in a function?

Answer Source

you can use glob() with GLOB_ONLYDIR option


$dirs = array_filter(glob('*'), 'is_dir');
print_r( $dirs);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download