Voting

: three plus one?
(Example: nine)

The Note You're Voting On

Anonymous
2 years ago
To create a min-heap priority queue, and have extract() give you the lowest priority:

class MinPriorityQueue extends SplPriorityQueue {
    public function compare($priority1, $priority2) {
        if ($priority1 === $priority2) return 0;
        return $priority1 > $priority2 ? 1 : -1; 
    }
}

<< Back to user notes page

To Top