3v4l.org

run code in 300+ PHP versions simultaneously
<?php function thing(array $needle, $haystack) { $result = array($haystack); foreach ($needle as $a) { $target = []; foreach ($result as $r) { $target = array_merge($target, explode($a, $r)); } $result = $target; } $result = array_filter($result); // Put the elements in needle back into the result $result = array_merge($needle, $result); return array_values($result); } var_dump(thing(array('THIS', 'test', 'hello', 'A', 'is'), 'helloTHISisAblindtest'));
Output for git.master, git.master_jit, rfc.property-hooks
array(6) { [0]=> string(4) "THIS" [1]=> string(4) "test" [2]=> string(5) "hello" [3]=> string(1) "A" [4]=> string(2) "is" [5]=> string(5) "blind" }

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:
43.9 ms | 401 KiB | 8 Q