Some time ago looking on the threads on array sorting I had come up with the following:
public function sortList(&$objects, $on, $order = 'ASC') {
$comparer = ($order === 'DESC')
? "return -strcmp(\$a->{$on},\$b->{$on});"
: "return strcmp(\$a->{$on},\$b->{$on});";
usort($objects, create_function('$a,$b', $comparer));
return $objects;
}
The above code works fine, the only problem is that it is case sensitive, whereas I'd like it to be case insensitive. Would it be possible without rewriting the whole thing?