3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arr = [ 'lala' => 123, 'lulu' => [ 'foo' => 'bar', 'wurs' => [ 'erdbaer', 'kaese' ] ], 'err' => [ 'da' => [ 'fuq' => 'yaye' ] ] ]; $it = new RecursiveArrayIterator($arr); $func = function(RecursiveArrayIterator $it) { while ($it->valid()) { $it->next(); } }; iterator_apply($it, $func, [$it]); echo '<pre>' . __FILE__ . ' on line ' . __LINE__ . PHP_EOL; print_r($it->getArrayCopy()); exit;
based on tB4jW
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.0 - 7.3.0beta1
<pre>/in/ouKi2 on line 27 Array ( [lala] => 123 [lulu] => Array ( [foo] => bar [wurs] => Array ( [0] => erdbaer [1] => kaese ) ) [err] => Array ( [da] => Array ( [fuq] => yaye ) ) )