Group and count items in a collection based on their value

  laravel, laravel-5, laravel-collection

I have the following collection:

0 => "15.00",
1 => "25.00",
2 => "500.00",
3 => "19.00",
4 => "123.00",
...

I want to somehow get the count of all values between 0 and 99, between 100 and 199, between 200 and 299, etc until the max amount.

Some collections might be up to 300 and some might be up to 1000. They still need to be counted by groups of 100.

Source: Laravel StackOverflow

Leave a Reply