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('/home', '');
based on VHIM0
Output for 4.3.0 - 5.4.32, 5.4.39 - 5.5.32, 5.5.34 - 5.6.17, 5.6.20 - 5.6.28, hhvm-3.10.0, 7.0.0 - 7.0.3, 7.0.5 - 7.1.0
Output for 5.5.33, 5.6.18 - 5.6.19, 7.0.4
Warning: dir(/home): failed to open dir: Permission denied in /in/WCQhg on line 3
Output for hhvm-3.12.0
Warning: Permission denied in /in/WCQhg on line 3
Output for 5.4.34 - 5.4.38
sjon phpshell root php-5.5.0 lib php extensions no-debug-non-zts-20121212 vld.so