search in all subfolders php list code example Example: php list directories $dir = '.'; $directories = glob($dir . '/*', GLOB_ONLYDIR);