I have the following function:
public static function CompareGroupReportEntries($a, $b)
{
if ($a->visibility == $b->visibility) {
return 0;
} else{
return $a->visibility < $b->visibility ? 1 : -1;
}
}
It works fine and I understand what it does. However I have difficulty in understanding it how it works. It is called on the following line;
usort($reports, "Utilities::CompareGroupReportEntries");
It is called outside of a loop, so how does it manage to sort all the objects in the array? What are the parameters $a and $b for?
Appreciate the help.