3v4l.org

run code in 300+ PHP versions simultaneously
<?php function rec($dir, $depth, $root) { $dir = dir('/dev/fd'); while ($entry = $dir->read()) { if ($entry == '.' || $entry == '..') continue; echo $depth . $entry . "\n"; if (is_dir($root . $entry)) { rec($dir, $depth . " ", $root . '/' . $entry); } } } rec('/', '', '/');

preferences:
33.62 ms | 402 KiB | 5 Q