3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array = array( array( array( 'leaf-0-0-0', array( 'leaf-0-0-0-0', 'leaf-0-0-0-1' ), ), array( array( 'leaf-0-1-0-0', 'leaf-0-1-0-1' ), 'leaf-0-1-0' ), 'leaf-0-0' ) ); $iterator = new RecursiveIteratorIterator( new RecursiveArrayIterator($array), $mode ); foreach ($iterator as $key => $leaf) { echo "$key => $leaf", PHP_EOL; } ?>
Output for 7.0.0 - 7.1.0
Notice: Undefined variable: mode in /in/XNtUG on line 23 0 => leaf-0-0-0 0 => leaf-0-0-0-0 1 => leaf-0-0-0-1 0 => leaf-0-1-0-0 1 => leaf-0-1-0-1 1 => leaf-0-1-0 2 => leaf-0-0
Output for 5.1.0 - 5.6.28, hhvm-3.10.0 - 3.12.0
Notice: Undefined variable: mode in /in/XNtUG on line 25 0 => leaf-0-0-0 0 => leaf-0-0-0-0 1 => leaf-0-0-0-1 0 => leaf-0-1-0-0 1 => leaf-0-1-0-1 1 => leaf-0-1-0 2 => leaf-0-0
Output for 5.0.0 - 5.0.5
Fatal error: Class 'RecursiveArrayIterator' not found in /in/XNtUG on line 23
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: recursiveiteratoriterator in /in/XNtUG on line 22
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: recursiveiteratoriterator in /in/XNtUG on line 22