3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr1 = [1, 2, 3, 7, 8, 9]; $arr2 = [4, 5, 6, 10, 11, 12, 13, 14]; $result = []; for ($i = 0; isset($arr1[$i]) || isset($arr2[$i]); $i += 3) { array_push($result, ...array_slice($arr1, $i, 3), ...array_slice($arr2, $i, 3)); } var_export($result); echo "\n"; var_export($arr1); echo "\n"; var_export($arr2);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => 1, 1 => 2, 2 => 3, 3 => 4, 4 => 5, 5 => 6, 6 => 7, 7 => 8, 8 => 9, 9 => 10, 10 => 11, 11 => 12, 12 => 13, 13 => 14, ) array ( 0 => 1, 1 => 2, 2 => 3, 3 => 7, 4 => 8, 5 => 9, ) array ( 0 => 4, 1 => 5, 2 => 6, 3 => 10, 4 => 11, 5 => 12, 6 => 13, 7 => 14, )

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