Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel collection splice

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

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

$chunk->all();

// [3, 4, 5]

$collection->all();

// [1, 2]
Source by laravel.com #
 
PREVIOUS NEXT
Tagged: #laravel #collection #splice
ADD COMMENT
Topic
Name
8+4 =