laravel/framework — pull request #2500 by abishekrsrikaanth (2013-10-16 14:57:52+00:00)
Title: Added new array_group_by helper function

The group by can be used to return an array object grouped based on the key specified.

**Example**

```
$arrayObj = array(
array('name'=>'Dean','type'=>'human'),
array('name'=>'Sam','type'=>'human'),
array('name'=>'Bobby','type'=>'human'),
array('name'=>'Castiel','type'=>'angel'),
array('name'=>'Meg','type'=>'demon'),
array('name'=>'Crowley','type'=>'demon'),
);

$resultObj = array_group_by($arrayObj, 'type');
```

**Result**

```
array('human'=> array(
array('name'=>'Dean','type'=>'human'),
array('name'=>'Sam','type'=>'human'),
array('name'=>'Bobby','type'=>'human')
),
'angel' => array(
array('name'=>'Castiel','type'=>'angel')
),
'demon' => array(
array('name'=>'Meg','type'=>'demon'),
array('name'=>'Crowley','type'=>'demon')
)
);
```