src/Ease/Sand.php
public static function reindexArrayBy($data, $indexBy = null)
    {
        $reindexedData = [];

        foreach ($data as $dataID => $data) {
            if (array_key_exists($indexBy, $data)) {
                $reindexedData[$data[$indexBy]] = $data;
            } else {
                throw new \Exception(sprintf('Data row does not contain column %s for reindexing',
                    $indexBy));
            }
        }

        return $reindexedData;
    }
public static function reindexArrayBy($data, $indexBy = null)
    {
        $reindexedData = [];

        foreach ($data as $dataID => $data) {
            if (array_key_exists($indexBy, $data)) {
                $reindexedData[$data[$indexBy]] = $data;
            } else {
                throw new \Exception(sprintf('Data row does not contain column %s for reindexing',
                    $indexBy));
            }
        }

        return $reindexedData;
    }
Reindex Array by given key.

@param array  $data    array to reindex
@param string $indexBy one of columns in array

@return array