3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array = array(1, array(2,3, array("a","b","c"))); print_r( $array ); $output = iterator_to_array(new RecursiveIteratorIterator( new RecursiveArrayIterator($array)), TRUE); print_r($output);
based on 2RIGK
Output for 5.2.1 - 7.1.0
Array ( [0] => 1 [1] => Array ( [0] => 2 [1] => 3 [2] => Array ( [0] => a [1] => b [2] => c ) ) ) Array ( [0] => a [1] => b [2] => c )
Output for 5.1.0 - 5.2.0
Array ( [0] => 1 [1] => Array ( [0] => 2 [1] => 3 [2] => Array ( [0] => a [1] => b [2] => c ) ) ) Warning: iterator_to_array() expects exactly 1 parameter, 2 given in /in/VkaXq on line 5
Output for 5.0.0 - 5.0.5
Array ( [0] => 1 [1] => Array ( [0] => 2 [1] => 3 [2] => Array ( [0] => a [1] => b [2] => c ) ) ) Fatal error: Call to undefined function iterator_to_array() in /in/VkaXq on line 4
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Array ( [0] => 1 [1] => Array ( [0] => 2 [1] => 3 [2] => Array ( [0] => a [1] => b [2] => c ) ) ) Fatal error: Call to undefined function: iterator_to_array() in /in/VkaXq on line 4
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Array ( [0] => 1 [1] => Array ( [0] => 2 [1] => 3 [2] => Array ( [0] => a [1] => b [2] => c ) ) ) Fatal error: Call to undefined function: iterator_to_array() in /in/VkaXq on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Array ( [0] => 1 [1] => Array ( [0] => 2 [1] => 3 [2] => Array ( [0] => a [1] => b [2] => c ) ) ) Fatal error: Call to undefined function: iterator_to_array() in /in/VkaXq on line 4