Testing a PHP distance grouping function