3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function rglob($pattern, $flags = 0, $path = '') { if (!$path && ($dir = dirname($pattern)) != '.') { if ($dir == '\\' || $dir == '/') $dir = ''; return rglob(basename($pattern), $flags, $dir . '/'); } $paths = glob($path . '*', GLOB_ONLYDIR | GLOB_NOSORT); $files = glob($path . $pattern, $flags); foreach ($paths as $p) $files = array_merge($files, rglob($pattern, $flags, $p . '/')); return $files; } $fileList = rglob("*", GLOB_MARK, '/etc/'); foreach($fileList as $index => $file) { if($file[strlen($file) - 1] != "/") { echo "f: ".$file."\n"; } else echo "d: ".$file."\n"; }