3v4l.org

run code in 300+ PHP versions simultaneously
<?php function flatArray($array) { $retval = array(); foreach ($array as $val) { if (is_array($val)) $retval = array_merge($retval, flatArray($val)); else $retval[] = $val; } return $retval; } $array1 = [['#90', '#91'], ['#92', '#93', '#94', '#95', '#96']]; $array2 = ['#82', '#83', '#84', '#85', '#86']; $array3 = [['#90', '#91', ['100', '101']], ['#92', '#93', '#94', '#95', '#96']]; print_r(flatArray($array1)); print_r(flatArray($array2)); print_r(flatArray($array3));
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => #90 [1] => #91 [2] => #92 [3] => #93 [4] => #94 [5] => #95 [6] => #96 ) Array ( [0] => #82 [1] => #83 [2] => #84 [3] => #85 [4] => #86 ) Array ( [0] => #90 [1] => #91 [2] => 100 [3] => 101 [4] => #92 [5] => #93 [6] => #94 [7] => #95 [8] => #96 )

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:
28.08 ms | 406 KiB | 5 Q