3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = [ 'a' => [ 'a1' => 'a1', 'a2' => 'a2', 'a3' => 'a3', ], 'b' => [ 'b1' => 'b1', 'b2' => 'b2', 'b3' => 'b3', ], ]; $it = new RecursiveIteratorIterator(RecursiveArrayIterator($a, RecursiveArrayIterator::CHILD_ARRAYS_ONLY)); $b = []; foreach ($it as $key => $value) { $b[$key] = $value; } var_dump($b);
based on aVaXR
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Call to undefined function RecursiveArrayIterator() in /in/uRZ8j:16 Stack trace: #0 {main} thrown in /in/uRZ8j on line 16
Process exited with code 255.
Output for 5.4.1 - 5.6.28
Fatal error: Call to undefined function RecursiveArrayIterator() in /in/uRZ8j on line 16
Process exited with code 255.
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/uRZ8j on line 3
Process exited with code 255.