3v4l.org

run code in 300+ PHP versions simultaneously
<?php $d = new RecursiveDirectoryIterator('.'); $tree = new RecursiveTreeIterator($d); $limit = new LimitIterator($tree, 0, 20); echo '<pre>'; foreach($limit as $element) { echo $element . '<br/>'; } echo '</pre>';
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.25, 7.4.27 - 7.4.32, 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught UnexpectedValueException: RecursiveDirectoryIterator::__construct(): open_basedir restriction in effect. File(.) is not within the allowed path(s): (/tmp:/in:/etc) in /in/AYgqn:3 Stack trace: #0 /in/AYgqn(3): RecursiveDirectoryIterator->__construct('.') #1 {main} thrown in /in/AYgqn on line 3
Process exited with code 255.
Output for 7.3.32 - 7.3.33, 7.4.26, 7.4.33, 8.0.13
<pre>|-./.<br/>|-./..<br/>|-./var<br/>| |-./var/.<br/>| |-./var/..<br/>| |-./var/cache<br/>| | |-./var/cache/.<br/>| | |-./var/cache/..<br/>| | \-./var/cache/pacman<br/>| | |-./var/cache/pacman/.<br/>| | |-./var/cache/pacman/..<br/>| | \-./var/cache/pacman/pkg<br/>| | |-./var/cache/pacman/pkg/.<br/>| | \-./var/cache/pacman/pkg/..<br/>| |-./var/lib<br/>| | |-./var/lib/.<br/>| | |-./var/lib/..<br/>| | |-./var/lib/pacman<br/>| | | |-./var/lib/pacman/.<br/>| | | |-./var/lib/pacman/..<br/></pre>
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Fatal error: Uncaught exception 'UnexpectedValueException' with message 'RecursiveDirectoryIterator::__construct(): open_basedir restriction in effect. File(.) is not within the allowed path(s): (/tmp:/in:/etc)' in /in/AYgqn:3 Stack trace: #0 /in/AYgqn(3): RecursiveDirectoryIterator->__construct('.') #1 {main} thrown in /in/AYgqn on line 3
Process exited with code 255.
Output for 5.3.23 - 5.3.29, 5.4.5 - 5.4.45
<pre>|-./.<br/>|-./..<br/>|-./bin<br/>|-./lib<br/>|-./lib64<br/>|-./sbin<br/>|-./boot<br/>| |-./boot/.<br/>| \-./boot/..<br/>|-./dev<br/>| |-./dev/.<br/>| |-./dev/..<br/>| |-./dev/console<br/>| |-./dev/mqueue<br/>| | |-./dev/mqueue/.<br/>| | \-./dev/mqueue/..<br/>| |-./dev/ptmx<br/>| |-./dev/pts<br/>| | |-./dev/pts/.<br/>| | |-./dev/pts/..<br/></pre>
Output for 5.3.0 - 5.3.21, 5.4.0 - 5.4.4
<pre>|-./bin<br/>|-./lib<br/>|-./lib64<br/>|-./sbin<br/>|-./boot<br/>|-./dev<br/>| |-./dev/console<br/>| |-./dev/mqueue<br/>| |-./dev/ptmx<br/>| |-./dev/pts<br/>| | |-./dev/pts/0<br/>| | \-./dev/pts/ptmx<br/>| |-./dev/stderr<br/>| |-./dev/stdout<br/>| |-./dev/stdin<br/>| |-./dev/fd<br/>| |-./dev/core<br/>| |-./dev/tty<br/>| |-./dev/urandom<br/>| |-./dev/random<br/></pre>
Output for 5.3.22
<pre>
Process exited with code 139.
Output for 5.1.3 - 5.1.6, 5.2.0 - 5.2.17
Fatal error: Uncaught exception 'UnexpectedValueException' with message 'RecursiveDirectoryIterator::__construct(.): failed to open dir: Permission denied' in /in/AYgqn:3 Stack trace: #0 /in/AYgqn(3): RecursiveDirectoryIterator->__construct('.') #1 {main} thrown in /in/AYgqn on line 3
Process exited with code 255.
Output for 5.1.2
Fatal error: Uncaught exception 'RuntimeException' with message 'RecursiveDirectoryIterator::__construct(.): failed to open dir: Permission denied' in /in/AYgqn:3 Stack trace: #0 /in/AYgqn(3): RecursiveDirectoryIterator->__construct('.') #1 {main} thrown in /in/AYgqn on line 3
Process exited with code 255.
Output for 5.1.0 - 5.1.1
Fatal error: Uncaught exception 'RuntimeException' with message 'DirectoryIterator::__construct(.): failed to open dir: Permission denied' in /in/AYgqn:3 Stack trace: #0 /in/AYgqn(3): DirectoryIterator->__construct('.') #1 {main} thrown in /in/AYgqn on line 3
Process exited with code 255.
Output for 5.0.5
Fatal error: Uncaught exception 'Exception' with message 'DirectoryIterator::__construct(.): failed to open dir: Permission denied' in /in/AYgqn:3 Stack trace: #0 /in/AYgqn(3): DirectoryIterator->__construct('.') #1 {main} thrown in /in/AYgqn on line 3
Process exited with code 255.
Output for 5.0.3 - 5.0.4
Fatal error: Uncaught exception 'Exception' with message 'DirectoryIterator::__construct(.): failed to open dir: Permission denied' in /in/AYgqn:3 Stack trace: #0 /in/AYgqn(3): RecursiveDirectoryIterator->__construct('.') #1 {main} thrown in /in/AYgqn on line 3
Process exited with code 255.
Output for 5.0.0 - 5.0.2
Fatal error: Uncaught exception 'Exception' with message 'DirectoryIterator::__construct(.): failed to open dir: Permission denied' in /in/AYgqn:3 Stack trace: #0 {main} thrown in /in/AYgqn on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
Fatal error: Cannot instantiate non-existent class: recursivedirectoryiterator in /in/AYgqn on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: recursivedirectoryiterator in /in/AYgqn on line 3

preferences:
307.06 ms | 401 KiB | 460 Q