I have an array in a variable which contains about 700 names. Iterating over the 700 names can be an issue since the array is large and could cause delay so i want to use chunk to see if it there will be no delay in my application.
In my code below, when i run the application, it throws the error
Call to a member function chunk() on array - Laravel
Is it possible i could chunk the data into pieces and iterate over the pieces so the application does not hang due to large data ?
PS: I am new to laravel PHP and sorry for my bad english.
Controller.php
$myData = $arrayList->chunk(ceil(($arrayList->count())/5));
foreach($chunks as $chunk){
Log::info('Chunking My Data');
Log::info($chunk);
}
collect($arrayList)->chunk(5)laravel.com/docs/8.x/collections#method-chunk