Answers for "laravel collection splice"

PHP
0

laravel collection splice

$collection = collect([1, 2, 3, 4, 5]);

$chunk = $collection->splice(2);

$chunk->all();

// [3, 4, 5]

$collection->all();

// [1, 2]
Posted by: Guest on July-24-2021

Browse Popular Code Answers by Language