I'm getting Warning: usort() [function.usort]: Invalid comparison function
Which points to
PHP Code:
if ($sort == "artist") usort($artistarray, "cmp_artist");
$artistarry is an array of objects which contain cmp_artist()
PHP Code:
static function cmp_artist($a, $b)
{
$tmp = strcasecmp($a->get_artist(),$b->get_artist());
if ($tmp)
{
return $tmp;
}
else
{
if($a->get_multiple() == $b->get_multiple() ) return "0";
if ($a->get_multiple() < $b->get_multiple() )
{ $tmp = "-1"; }
else
{ $tmp = "1";}
return $tmp;
}
}
It is meant to sort the array by the artists name alphabetically, and if the artist appearance more than once the sort it them numerically based on it's multiple count. (the array is created in appearance order)