Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel collection reject

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

$filtered = $collection->reject(function ($value, $key) {
    return $value > 2;
});

$filtered->all();

// [1, 2]
Source by laravel.com #
 
PREVIOUS NEXT
Tagged: #laravel #collection #reject
ADD COMMENT
Topic
Name
7+6 =