Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel collection shuffle

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

$shuffled = $collection->shuffle();

$shuffled->all();

// [3, 2, 5, 1, 4] - (generated randomly)
Source by laravel.com #
 
PREVIOUS NEXT
Tagged: #laravel #collection #shuffle
ADD COMMENT
Topic
Name
4+1 =