3v4l.org

run code in 300+ PHP versions simultaneously
<?php function special_chunk($array, $size) { $chunks = array_chunk($array, 2); $count = count($chunks); if( count($chunks[$count-1]) < $size ) { $chunks[$count-2] = array_merge($chunks[$count-2], $chunks[$count-1]); unset($chunks[$count-1]); } return $chunks; } $languages = range(1, 11); var_dump( special_chunk($languages, 3) );
Output for git.master, git.master_jit, rfc.property-hooks
array(5) { [0]=> array(2) { [0]=> int(1) [1]=> int(2) } [1]=> array(2) { [0]=> int(3) [1]=> int(4) } [2]=> array(2) { [0]=> int(5) [1]=> int(6) } [3]=> array(2) { [0]=> int(7) [1]=> int(8) } [4]=> array(3) { [0]=> int(9) [1]=> int(10) [2]=> int(11) } }

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