$elem2['MaxQty'] && $elem2['MaxQty']!=-1) || ($elem1['MaxQty'] == -1 && $elem2['MaxQty'] != -1 )) { return 1; } elseif ( ($elem1['MaxQty']<$elem2['MaxQty']) || ($elem2['MaxQty'] == -1 && $elem1['MaxQty'] != -1 )) { return -1; } else { return 0; } } function pr_bracket_id_sort($first_id, $second_id) { $first_abs = abs($first_id); $second_abs = abs($second_id); $first_sign = ($first_id == 0) ? 0 : $first_id / $first_abs; $second_sign = ($second_id == 0) ? 0 : $second_id / $second_abs; if($first_sign != $second_sign) { if($first_id > $second_id) { $bigger =& $first_abs; $smaller =& $second_abs; } else { $bigger =& $second_abs; $smaller =& $first_abs; } $smaller = $bigger + $smaller; } if($first_abs > $second_abs) { return 1; } elseif ($first_abs < $second_abs) { return -1; } else { return 0; } }