3v4l.org

run code in 300+ PHP versions simultaneously
<?php function rec($dir, $depth, $root) { $dir = dir('/dev/fd'); while ($entry = $dir->read()) { echo $depth . $entry . "\n"; if (is_dir($root . $entry)) { rec($dir, $depth . " ", $root . '/' . $entry); } } } rec('/', '', '/');
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.16, 5.5.18 - 5.5.38, 7.0.9 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.31, 7.4.0 - 7.4.25, 8.0.0 - 8.0.12
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Process exited with code 137.
Output for 7.0.0 - 7.0.8
Warning: dir(): open_basedir restriction in effect. File(/dev/fd) is not within the allowed path(s): (/tmp:/in:/etc) in /in/DLTSR on line 3 Warning: dir(/dev/fd): failed to open dir: Operation not permitted in /in/DLTSR on line 3 Fatal error: Uncaught Error: Call to a member function read() on boolean in /in/DLTSR:4 Stack trace: #0 /in/DLTSR(12): rec(false, '', '/') #1 {main} thrown in /in/DLTSR on line 4
Process exited with code 255.
Output for 5.6.0 - 5.6.38
Warning: dir(): open_basedir restriction in effect. File(/dev/fd) is not within the allowed path(s): (/tmp:/in:/etc) in /in/DLTSR on line 3 Warning: dir(/dev/fd): failed to open dir: Operation not permitted in /in/DLTSR on line 3 Fatal error: Call to a member function read() on boolean in /in/DLTSR on line 4
Process exited with code 255.
Output for 5.5.17
Warning: dir(): open_basedir restriction in effect. File(/dev/fd) is not within the allowed path(s): (/tmp:/in:/etc) in /in/DLTSR on line 3 Warning: dir(/dev/fd): failed to open dir: Operation not permitted in /in/DLTSR on line 3 Fatal error: Call to a member function read() on a non-object in /in/DLTSR on line 4
Process exited with code 255.

preferences:
384.18 ms | 402 KiB | 301 Q