3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function rec($dir, $depth) { $d = dir($dir); if (!$d) return; while ($entry = $d->read()) { if ($entry == '.' || $entry == '..') continue; echo $depth . $entry . "\n"; if (is_dir($dir . '/' . $entry)) { rec($dir . '/' . $entry, $depth . " "); } } } rec('/Users/stepanenko', '');
based on W3SEg
Output for 4.3.2 - 5.6.21, 7.0.0 - 7.1.0
Warning: dir(/Users/stepanenko): failed to open dir: No such file or directory in /in/5ZB6N on line 3
Output for hhvm-3.10.0 - 3.12.0
Warning: No such file or directory in /in/5ZB6N on line 3
Output for 4.3.0 - 4.3.1
Warning: dir(/Users/stepanenko) [http://www.php.net/function.dir]: failed to open dir: No such file or directory in /in/5ZB6N on line 3