3v4l.org

run code in 150+ 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 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 5.0.0 - 5.6.25, 7.0.0 - 7.0.10
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 hhvm-3.10.0 - 3.12.0
0 => . 1 => .. 2 => cache 3 => lib 4 => log 5 => local 6 => opt 7 => empty 8 => tmp 9 => spool 10 => games 11 => db 12 => mail 13 => run 14 => lock
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