[lang-ref] ( get_chunks_by_n_count ) ( php )
<?php
public function testGetChunksByNCount(): void
{
// array_chunk($items, $n)
$items = ['A1', 'A2', 'A3', 'B1', 'B2', 'B3', 'C1', 'C2'];
$n = 3;
$chunks = array_chunk($items, $n);
$this->assertSame([
['A1', 'A2', 'A3'],
['B1', 'B2', 'B3'],
['C1', 'C2'],
], $chunks);
}