Illuminate\Support\Collection avg() and average() function gives unexpected result on collection class in laravel 5.4 version for example : $collection = collect([['c'=>1], ['b'=>2], ['c'=>3]])->avg('c'); return $collection; result : 1.3333333333333
this is too ---->$collection = collect([1, 2, 3, 4, 5, 6, 7]);
$chunks = $collection->chunk(4);
$chunks->toArray(); result : [[1,2,3,4],{"4":5,"5":6,"6":7}]
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community