3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = ['A', 'B', 'C', 'D', 'E', 'F', 'G']; $cols = 2; $rows = ceil(count($input) / $cols); $result = []; foreach ($input as $i => $value) { $result[$i % $rows][] = $value; } var_export($result);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => array ( 0 => 'A', 1 => 'E', ), 1 => array ( 0 => 'B', 1 => 'F', ), 2 => array ( 0 => 'C', 1 => 'G', ), 3 => array ( 0 => 'D', ), )

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