As an answerer and curator of many [php][arrays][grouping] tagged questions on Stack Overflow for several years, I'd like to mention that developers' non-SQL grouping needs are much more nuanced than merely defining group qualification and creating subarrays.
Often devs will want to sum, count (increment a counter), concatenate another column (or columns), or otherwise mutate the encountered row in each group. Have you considered the extendability of your pitched function? Without these extra considerations, devs would need to make another pass over the new nested structure. mickmackusa