如何使用X元素重新组合数组?

I have an array with X (let's say 40) elements. Now I need to regroup the X elements become Y (let's say 8) sub-arrays. Each sub-array consists of Z (let's say 5) elements. How can I do this?

$numbers = array('1','2',...,'40'); //original array
$numbers = array(array('1','2','3','4','5'), array('6','7','8','9','10'), ...);

Thank you in advance.

The function array_chunk does this:

$numbers = array_chunk($numbers, 5);

Knowing the numbers, you can loop through the original array, and in the loop, take (5) elements, and put them into a new array, which you then shove into the output.