Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel collection remove empty

$collection = collect([1, 2, 3, null, false, '', 0, []]);

$collection->filter()->all();

// [1, 2, 3]
Source by laracasts.com #
 
PREVIOUS NEXT
Tagged: #laravel #collection #remove #empty
ADD COMMENT
Topic
Name
9+5 =