Skip to content

Instantly share code, notes, and snippets.

View Mrxchaoz's full-sized avatar
💭
I may be slow to respond.

Mrxchaoz

💭
I may be slow to respond.
View GitHub Profile
@Mrxchaoz
Mrxchaoz / Function.Array-Group-By.php
Created January 21, 2020 02:47 — forked from mcaskill/Function.Array-Group-By.php
PHP : Groups an array by a given key
<?php
if (!function_exists('array_group_by')) {
/**
* Groups an array by a given key.
*
* Groups an array into arrays by a given key, or set of keys, shared between all array members.
*
* Based on {@author Jake Zatecky}'s {@link https://github.com/jakezatecky/array_group_by array_group_by()} function.
* This variant allows $key to be closures.