3v4l.org

run code in 300+ PHP versions simultaneously
<?php function double_chunk($array, $maxrows) { $size = sizeof($array); $columns = ceil($size / $maxrows); $fullrows = $size - ($columns - 1) * $maxrows; if ($fullrows == $maxrows) { return array_chunk($array, $fullrows); // all columns have full rows, don't splice } return array_merge( array_chunk( array_splice($array, 0, $columns * $fullrows), $columns ), array_chunk($array, $columns - 1) ); } var_export(double_chunk(range('a', 'g'), 4));
Output for git.master_jit, git.master, rfc.property-hooks
array ( 0 => array ( 0 => 'a', 1 => 'b', ), 1 => array ( 0 => 'c', 1 => 'd', ), 2 => array ( 0 => 'e', 1 => 'f', ), 3 => array ( 0 => 'g', ), )

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