3v4l.org

run code in 300+ PHP versions simultaneously
<?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"; }
Output for 7.4.26 - 7.4.32, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
f: /etc/arch-release f: /etc/crypttab f: /etc/fstab f: /etc/group f: /etc/gshadow f: /etc/host.conf f: /etc/hosts f: /etc/issue f: /etc/ld.so.conf d: /etc/ld.so.conf.d/ f: /etc/motd f: /etc/nsswitch.conf d: /etc/pacman.d/ f: /etc/passwd f: /etc/php.ini f: /etc/php_archive.ini f: /etc/profile d: /etc/profile.d/ f: /etc/protocols f: /etc/resolv.conf f: /etc/securetty f: /etc/services f: /etc/shadow f: /etc/shells d: /etc/skel/ f: /etc/pacman.d/mirrorlist f: /etc/profile.d/locale.sh
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.25, 8.0.0 - 8.0.13
f: /etc/arch-release f: /etc/crypttab f: /etc/fstab f: /etc/group f: /etc/gshadow f: /etc/host.conf f: /etc/hosts f: /etc/issue f: /etc/ld.so.conf d: /etc/ld.so.conf.d/ f: /etc/motd f: /etc/mtab f: /etc/nsswitch.conf d: /etc/pacman.d/ f: /etc/passwd f: /etc/profile d: /etc/profile.d/ f: /etc/protocols f: /etc/resolv.conf f: /etc/securetty f: /etc/services f: /etc/shadow f: /etc/shells d: /etc/skel/ f: /etc/pacman.d/mirrorlist f: /etc/profile.d/locale.sh
Output for 7.4.33
f: /etc/arch-release f: /etc/crypttab f: /etc/fstab f: /etc/group f: /etc/gshadow f: /etc/host.conf f: /etc/hosts f: /etc/issue f: /etc/ld.so.conf d: /etc/ld.so.conf.d/ f: /etc/motd f: /etc/mtab f: /etc/nsswitch.conf d: /etc/pacman.d/ f: /etc/passwd f: /etc/php.ini f: /etc/php_archive.ini f: /etc/profile d: /etc/profile.d/ f: /etc/protocols f: /etc/resolv.conf f: /etc/securetty f: /etc/services f: /etc/shadow f: /etc/shells d: /etc/skel/ f: /etc/pacman.d/mirrorlist f: /etc/profile.d/locale.sh

preferences:
293.75 ms | 402 KiB | 416 Q