3v4l.org

run code in 300+ PHP versions simultaneously
<?php foreach(new GlobIterator('/var/log/*.log', FilesystemIterator::SKIP_DOTS) as $note_file) { echo $note_file . PHP_EOL; echo file_get_contents($note_file); }
Output for 7.0.20, 7.1.5 - 7.1.10, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Output for 7.1.25 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.32, 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28
Fatal error: Uncaught UnexpectedValueException: GlobIterator::__construct(): open_basedir restriction in effect. File(/var/log/*.log) is not within the allowed path(s): (/tmp:/in:/etc) in /in/h8Jc6:3 Stack trace: #0 /in/h8Jc6(3): GlobIterator->__construct('/var/log/*.log', 4096) #1 {main} thrown in /in/h8Jc6 on line 3
Process exited with code 255.
Output for 7.3.32 - 7.3.33, 7.4.33, 8.0.13
/var/log/pacman.log [2021-10-24T13:19:16+0200] [PACMAN] Running 'pacman -r /var/lib/machines/phpShell.new/ -Sy --cachedir=/var/lib/machines/phpShell.new//var/cache/pacman/pkg --noconfirm filesystem' [2021-10-24T13:19:16+0200] [PACMAN] synchronizing package lists [2021-10-24T13:19:16+0200] [ALPM] transaction started [2021-10-24T13:19:16+0200] [ALPM] installed iana-etc (20210903-1) [2021-10-24T13:19:16+0200] [ALPM] installed filesystem (2021.05.31-1) [2021-10-24T13:19:16+0200] [ALPM] transaction completed
Output for 7.1.20
Fatal error: Uncaught UnexpectedValueException: GlobIterator::__construct(): open_basedir restriction in effect. File(/var/log/*.log) is not within the allowed path(s): (/tmp:/in) in /in/h8Jc6:3 Stack trace: #0 /in/h8Jc6(3): GlobIterator->__construct('/var/log/*.log', 4096) #1 {main} thrown in /in/h8Jc6 on line 3
Process exited with code 255.

preferences:
151.52 ms | 401 KiB | 194 Q