Ok, after much deliberation, I decided to go the "sort every column" route.
For future reference by anyone interested, here's the function I've added to my class - it's called once per every column I need ranked:
private function calculateRankings(&$employees, $columnName) {
$comparer = "return (\$a[$columnName][0] == \$b[$columnName][0]) ? 0 : (\$a[$columnName][0] > \$b[$columnName][0] ? -1 : 1);";
usort($employees, create_function('$a,$b', $comparer));
foreach($employees as $key => &$employee) {
$employee[$columnName][1] = $key + 1;
}
}
The +1 is due to the keys being zero-based.
You prepare for this function by turning each field you need ranked into a 2-element array: the first ([0]) contains the value, and the second ([1]) will contain the rank in the end.
I.e.: $employees['salary'] = array(1550, 0);
.
You then call the function like this:
$this->calculateRankings($employees, 'salary');
.
I sincerely hope this helps someone, someday. Thanks to all responders/commenters!
UPDATE 4/9: The function I supplied before couldn't work - there's no way to pass a third parameter (in our case, the column name) into the comparer function. The only way to do it is to use a static class variable, or a create_function hack that I ended up with. Sorry for any confusion.