3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php try { /*** freds home directory ***/ $rdi = new recursiveDirectoryIterator('/tmp', FilesystemIterator::SKIP_DOTS | FilesystemIterator::UNIX_PATHS); $it = new recursiveIteratorIterator( $rdi ); $it->seek(2); while( $it->valid()) { if( $it->isFile() ) { echo $it->current()."\n"; } /*** move to the next element ***/ $it->next(); } $it->rewind(); echo $it->current(); } catch(Exception $e) { /*** echo the error message ***/ echo $e->getMessage(); } ?>
Output for 5.6.16 - 5.6.28, 7.0.1 - 7.1.0
Seek position 2 is out of range
Output for 5.3.0 - 5.6.15, 7.0.0
Could not open file