collect() with chunk() #38255
-
Description:Shouldn't the collection of the 1st chunk (in the output below) return something like ?
Steps To Reproduce:echo 'collect([1,2,3,4,5,6])->chunk(2)' | php artisan tinker |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Array indexes in php are zero-based, which means the first element has an index of 0. So the expected output is
which is equivalent to your output
|
Beta Was this translation helpful? Give feedback.
Array indexes in php are zero-based, which means the first element has an index of 0.
So the expected output is
[0 => 1, 1 => 2]
which is equivalent to your output
[1, 2]