3v4l.org

run code in 300+ PHP versions simultaneously
<?php $myArray = array( 0 => 'a', 1 => array('subA','subB',array(0 => 'subsubA', 1 => 'subsubB', 2 => array(0 => 'deepA', 1 => 'deepB'))), 2 => 'b', 3 => array('subA','subB','subC'), 4 => 'c' ); $iterator = new RecursiveArrayIterator($myArray); iterator_apply($iterator, 'traverseStructure', array($iterator)); function traverseStructure($iterator) { while ( $iterator -> valid() ) { if ( $iterator -> hasChildren() ) { traverseStructure($iterator -> getChildren()); } else { echo $iterator -> key() . ' : ' . $iterator -> current() .PHP_EOL; } $iterator -> next(); } }
Output for git.master, git.master_jit, rfc.property-hooks
0 : a 0 : subA 1 : subB 0 : subsubA 1 : subsubB 0 : deepA 1 : deepB 2 : b 0 : subA 1 : subB 2 : subC 4 : c

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
45.08 ms | 401 KiB | 8 Q