3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = range(1, 65); $minColumns = 9; $count = count($array); $maxRows = intdiv($count, $minColumns); $maxColumns = ceil($count / $maxRows); $longRowsCount = $count % $maxRows; echo "$count, $maxRows, $maxColumns, $longRowsCount\n"; var_export([ ...array_chunk( array_splice( $array, 0, ($maxColumns * $longRowsCount) ?: $count ), $maxColumns ), ...array_chunk($array, $maxColumns - 1) ]);
Output for git.master, git.master_jit, rfc.property-hooks
65, 7, 10, 2 array ( 0 => array ( 0 => 1, 1 => 2, 2 => 3, 3 => 4, 4 => 5, 5 => 6, 6 => 7, 7 => 8, 8 => 9, 9 => 10, ), 1 => array ( 0 => 11, 1 => 12, 2 => 13, 3 => 14, 4 => 15, 5 => 16, 6 => 17, 7 => 18, 8 => 19, 9 => 20, ), 2 => array ( 0 => 21, 1 => 22, 2 => 23, 3 => 24, 4 => 25, 5 => 26, 6 => 27, 7 => 28, 8 => 29, ), 3 => array ( 0 => 30, 1 => 31, 2 => 32, 3 => 33, 4 => 34, 5 => 35, 6 => 36, 7 => 37, 8 => 38, ), 4 => array ( 0 => 39, 1 => 40, 2 => 41, 3 => 42, 4 => 43, 5 => 44, 6 => 45, 7 => 46, 8 => 47, ), 5 => array ( 0 => 48, 1 => 49, 2 => 50, 3 => 51, 4 => 52, 5 => 53, 6 => 54, 7 => 55, 8 => 56, ), 6 => array ( 0 => 57, 1 => 58, 2 => 59, 3 => 60, 4 => 61, 5 => 62, 6 => 63, 7 => 64, 8 => 65, ), )

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:
114.23 ms | 409 KiB | 5 Q