Update ext.group_by.php

Looks like a handy extension. Just made some changes so the function returns as early as possible if there is nothing else to do. Reduces nesting and makes it easier to read.
Merge pull request #1 from litzinger/patch-1

Update ext.group_by.php