3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (class_exists('RecursiveDirectoryIterator')) { $i1 = new RecursiveDirectoryIterator('/tmp'); $i2 = new RecursiveDirectoryIterator('/home'); foreach($i1 as $f) { var_dump((string) $f); } foreach($i2 as $f) { var_dump((string) $f); } var_dump($i1 == $i2); } else { var_dump('Class RecursiveDirectoryIterator does not exist'); }
Output for 7.2.29 - 7.2.33, 7.3.16 - 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, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught UnexpectedValueException: RecursiveDirectoryIterator::__construct(): open_basedir restriction in effect. File(/home) is not within the allowed path(s): (/tmp:/in:/etc) in /in/baBjg:5 Stack trace: #0 /in/baBjg(5): RecursiveDirectoryIterator->__construct('/home') #1 {main} thrown in /in/baBjg on line 5
Process exited with code 255.
Output for 8.0.13
Fatal error: Uncaught UnexpectedValueException: RecursiveDirectoryIterator::__construct(/home): Failed to open directory: Permission denied in /in/baBjg:5 Stack trace: #0 /in/baBjg(5): RecursiveDirectoryIterator->__construct('/home') #1 {main} thrown in /in/baBjg on line 5
Process exited with code 255.
Output for 7.2.0, 7.3.32 - 7.3.33, 7.4.33
Fatal error: Uncaught UnexpectedValueException: RecursiveDirectoryIterator::__construct(/home): failed to open dir: Permission denied in /in/baBjg:5 Stack trace: #0 /in/baBjg(5): RecursiveDirectoryIterator->__construct('/home') #1 {main} thrown in /in/baBjg on line 5
Process exited with code 255.
Output for 5.4.5 - 5.4.45, 5.5.0 - 5.5.36, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.10
string(6) "/tmp/." string(7) "/tmp/.." string(7) "/home/." string(8) "/home/.." bool(true)
Output for 5.4.0 - 5.4.4
bool(true)

preferences:
217.31 ms | 401 KiB | 261 Q