3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $object = new stdClass; $object->property1 = 'property 1'; $object->property2 = 'property 2'; $array = array( array('pear', 'apple'), array('banana', 'coconut'), 'orange', // This is not an array element $object ); $iterator = new RecursiveArrayIterator($array); foreach(new RecursiveIteratorIterator($iterator) as $value) { echo $value . PHP_EOL; }
based on RNKd1
Output for 5.1.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
pear apple banana coconut orange property 1 property 2
Output for 5.0.0 - 5.0.5
Fatal error: Class 'RecursiveArrayIterator' not found in /in/KGgLb on line 13
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: recursivearrayiterator in /in/KGgLb on line 13
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: recursivearrayiterator in /in/KGgLb on line 13