sortBy: _::sortBy([1, 2, 3, 4, 5, 6], function ($num) { return sin($num); }); // => [5, 4, 6, 3, 1, 2] groupBy: _::groupBy([1.3, 2.1, 2.4], function ($num) { return floor($num); }); // => [1 => [1.3], 2 => [2.1, 2.4]] $values = [['val' => 'one', 'length' => 3], ['val' => 'two', 'length' => 3], ['val' => 'three', 'length' => 5]]; _::groupBy($values, 'length'); // => [3 => [['val' => 'one', 'lenght' => 3], ['val' => 'two', 'length' => 3], 5 => [['val' => 'three', 'length' => 5]]] indexBy: $stooges = [['name' => 'moe', 'age' => 40], ['name' => 'larry', 'age' => 50], ['name' => 'curly', 'age' => 60]]; _::indexBy($stooges, 'age'); // => [ // "40" => ['name' => 'moe', 'age' => 40], // "50" => ['name' => 'larry', 'age' => 50], // "60" => ['name' => 'curly', 'age' => 60] // ] countBy: _::countBY([1, 2, 3, 4, 5], function ($num) { return $num % 2 == 0 ? 'even' : 'odd'; }); // => ['odd' => 3, 'even' => 2] shuffle: _::shuffle([1, 2, 3, 4, 5, 6]); // => [4, 1, 6, 3, 5, 2] sample: _::sample([1, 2, 3, 4, 5, 6]);