3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php //$f = new SplFileObject('/home/a.txt', "w+"); $iterator = new DirectoryIterator('/var'); while($iterator->valid()) { $file = $iterator->current(); echo $iterator->key() . " => " . $file->getFilename() . "\n"; $iterator->next(); }
Output for 7.3.0rc3 - 7.3.0rc4
Fatal error: Uncaught UnexpectedValueException: DirectoryIterator::__construct(): open_basedir restriction in effect. File(/var) is not within the allowed path(s): (/tmp:/in:/etc) in /in/rirSp:3 Stack trace: #0 /in/rirSp(3): DirectoryIterator->__construct('/var') #1 {main} thrown in /in/rirSp on line 3
Process exited with code 255.
Output for 5.0.0 - 5.6.25, 7.0.0 - 7.0.10, 7.0.20, 7.1.5 - 7.1.10, 7.3.0alpha1 - 7.3.0beta1
0 => . 1 => .. 2 => lock 3 => mail 4 => run 5 => cache 6 => db 7 => empty 8 => games 9 => lib 10 => local 11 => log 12 => opt 13 => spool 14 => tmp
Output for 7.1.20, 7.2.6
Fatal error: Uncaught UnexpectedValueException: DirectoryIterator::__construct(): open_basedir restriction in effect. File(/var) is not within the allowed path(s): (/tmp:/in) in /in/rirSp:3 Stack trace: #0 /in/rirSp(3): DirectoryIterator->__construct('/var') #1 {main} thrown in /in/rirSp on line 3
Process exited with code 255.
Output for 7.2.0
Fatal error: Uncaught UnexpectedValueException: DirectoryIterator::__construct(/var): failed to open dir: Permission denied in /in/rirSp:3 Stack trace: #0 /in/rirSp(3): DirectoryIterator->__construct('/var') #1 {main} thrown in /in/rirSp on line 3
Process exited with code 255.
Output for 5.6.28, 7.0.14, 7.1.0
0 => . 1 => .. 2 => cache 3 => db 4 => empty 5 => games 6 => lib 7 => local 8 => log 9 => opt 10 => spool 11 => tmp 12 => mail 13 => lock 14 => run
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: directoryiterator in /in/rirSp on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: directoryiterator in /in/rirSp on line 3