<?php function partition($arr, ...$chunks) { $res = []; foreach($chunks as $n) { $res[] = array_splice($arr, 0, $n); } return $res; } $arr = ['a', 'f', 'j', 'r', 'c', 'j', 'd']; print_r(partition($arr, 2, 3, 2)); ?>
You have javascript disabled. You will not be able to edit any code.