3v4l.org

run code in 300+ PHP versions simultaneously
<?php foreach (scandir("/") as $f) { if (is_dir($f)) { $di = new DirectoryIterator($f); echo sprintf("%30s: %d\n", $di->getPathname(), $di->isDir()); } }
Output for 8.3.0 - 8.3.7
Warning: scandir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/tmp:/in:/etc) in /in/9sLZ0 on line 3 Warning: scandir(/): Failed to open directory: Operation not permitted in /in/9sLZ0 on line 3 Warning: scandir(): (errno 1): Operation not permitted in /in/9sLZ0 on line 3 Warning: foreach() argument must be of type array|object, false given in /in/9sLZ0 on line 3
Output for 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19
Warning: scandir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/tmp:/in:/etc) in /in/9sLZ0 on line 3 Warning: scandir(/): Failed to open directory: Operation not permitted in /in/9sLZ0 on line 3 Warning: scandir(): (errno 1): Operation not permitted in /in/9sLZ0 on line 3 Warning: foreach() argument must be of type array|object, bool given in /in/9sLZ0 on line 3
Output for 8.0.13
./.: 1 ../.: 1 Fatal error: Uncaught UnexpectedValueException: DirectoryIterator::__construct(bin): Failed to open directory: Permission denied in /in/9sLZ0:5 Stack trace: #0 /in/9sLZ0(5): DirectoryIterator->__construct('bin') #1 {main} thrown in /in/9sLZ0 on line 5
Process exited with code 255.
Output for 8.0.0 - 8.0.12
./.: 1 ../.: 1 bin/.: 1 boot/.: 1 dev/.: 1 etc/.: 1 Fatal error: Uncaught UnexpectedValueException: DirectoryIterator::__construct(home): Failed to open directory: Permission denied in /in/9sLZ0:5 Stack trace: #0 /in/9sLZ0(5): DirectoryIterator->__construct('home') #1 {main} thrown in /in/9sLZ0 on line 5
Process exited with code 255.
Output for 7.3.32 - 7.3.33, 7.4.33
./.: 1 ../.: 1 Fatal error: Uncaught UnexpectedValueException: DirectoryIterator::__construct(bin): failed to open dir: Permission denied in /in/9sLZ0:5 Stack trace: #0 /in/9sLZ0(5): DirectoryIterator->__construct('bin') #1 {main} thrown in /in/9sLZ0 on line 5
Process exited with code 255.
Output for 7.4.26 - 7.4.32
Warning: scandir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/tmp:/in:/etc) in /in/9sLZ0 on line 3 Warning: scandir(/): failed to open dir: Operation not permitted in /in/9sLZ0 on line 3 Warning: scandir(): (errno 1): Operation not permitted in /in/9sLZ0 on line 3 Warning: Invalid argument supplied for foreach() in /in/9sLZ0 on line 3
Output for 7.0.0 - 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
./.: 1 ../.: 1 bin/.: 1 boot/.: 1 dev/.: 1 etc/.: 1 Fatal error: Uncaught UnexpectedValueException: DirectoryIterator::__construct(home): failed to open dir: Permission denied in /in/9sLZ0:5 Stack trace: #0 /in/9sLZ0(5): DirectoryIterator->__construct('home') #1 {main} thrown in /in/9sLZ0 on line 5
Process exited with code 255.
Output for 5.6.0 - 5.6.40
./.: 1 ../.: 1 bin/.: 1 boot/.: 1 dev/.: 1 etc/.: 1 Fatal error: Uncaught exception 'UnexpectedValueException' with message 'DirectoryIterator::__construct(home): failed to open dir: Permission denied' in /in/9sLZ0:5 Stack trace: #0 /in/9sLZ0(5): DirectoryIterator->__construct('home') #1 {main} thrown in /in/9sLZ0 on line 5
Process exited with code 255.

preferences:
184.48 ms | 402 KiB | 302 Q