3v4l.org

run code in 300+ PHP versions simultaneously
<?php function array_flatten_iterator (array $array) { foreach ($array as $value) { if (is_array($value)) { yield from array_flatten_iterator($value); } else { yield $value; } } } function array_flatten (array $array) { return iterator_to_array(array_flatten_iterator($array), false); } $array = [ 1, 2, [ 3, 4, 5, [ 6, 7 ], 8, 9, ], 10, 11, ]; var_dump(array_flatten($array));
Output for git.master_jit, git.master, rfc.property-hooks
array(11) { [0]=> int(1) [1]=> int(2) [2]=> int(3) [3]=> int(4) [4]=> int(5) [5]=> int(6) [6]=> int(7) [7]=> int(8) [8]=> int(9) [9]=> int(10) [10]=> int(11) }

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:
29.24 ms | 405 KiB | 5 Q