3v4l.org

run code in 300+ PHP versions simultaneously
<?php $nu_array = null; $callback = function ( $item ) use(&$callback, &$nu_array) { if (!is_array($item)) { $nu_array[] = $item; } else if ( is_array( $item ) ) { foreach( array_values($item) as $v) { if ( !(is_array($v))) { $nu_array[] = $v; } else { $callback( $v ); continue; } } } }; $array = array('alpha',array(1,2,3),'beta',array(7,8,array(9,10))); array_walk_recursive($array, $callback); print_r($nu_array); $output = array(); array_walk_recursive($array, function ($current) use (&$output) { $output[] = $current; }); print_r($output); print "\n...................................\n"; $output = array(); array_walk($array, function ($current) use (&$output) { $output[] = $current; }); print_r($output); print "\n\n...................................\n"; $output = iterator_to_array(new RecursiveIteratorIterator( new RecursiveArrayIterator($array)), FALSE); print_r($output);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => alpha [1] => 1 [2] => 2 [3] => 3 [4] => beta [5] => 7 [6] => 8 [7] => 9 [8] => 10 ) Array ( [0] => alpha [1] => 1 [2] => 2 [3] => 3 [4] => beta [5] => 7 [6] => 8 [7] => 9 [8] => 10 ) ................................... Array ( [0] => alpha [1] => Array ( [0] => 1 [1] => 2 [2] => 3 ) [2] => beta [3] => Array ( [0] => 7 [1] => 8 [2] => Array ( [0] => 9 [1] => 10 ) ) ) ................................... Array ( [0] => alpha [1] => 1 [2] => 2 [3] => 3 [4] => beta [5] => 7 [6] => 8 [7] => 9 [8] => 10 )

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:
38.02 ms | 403 KiB | 8 Q