3v4l.org

run code in 300+ PHP versions simultaneously
<?php var_export( array2cols(range('a', 'r'), 12) ); function array2cols($array,$n){ $groups = array(); for($i=0;$i<$n;$i++){ $groups[$i] = array(); } $col = 0; foreach($array as $row){ $groups[$col][] = $row; $col = ($col+1)%$n; } return $groups; }
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => array ( 0 => 'a', 1 => 'm', ), 1 => array ( 0 => 'b', 1 => 'n', ), 2 => array ( 0 => 'c', 1 => 'o', ), 3 => array ( 0 => 'd', 1 => 'p', ), 4 => array ( 0 => 'e', 1 => 'q', ), 5 => array ( 0 => 'f', 1 => 'r', ), 6 => array ( 0 => 'g', ), 7 => array ( 0 => 'h', ), 8 => array ( 0 => 'i', ), 9 => array ( 0 => 'j', ), 10 => array ( 0 => 'k', ), 11 => array ( 0 => 'l', ), )

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:
56.97 ms | 402 KiB | 8 Q