- dir: documentation ( source)
- is_dir: documentation ( source)
<?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('/', '', '/');