3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h' ,'i', 'j', 'k']; $columnCount = 2; $columns = []; foreach ($a as $i => $key) { $columns[$i % $columnCount][] = $key; } var_dump($columns);