Voting

: max(four, seven)?
(Example: nine)

The Note You're Voting On

Anonymous
16 years ago
At this time, the documentation sais "Note: Multiple elements with the same priority will get dequeued in no particular order."

If you need elements of equal priority to maintain insertion order, you can use something like:

<?php

class StablePriorityQueue extends SplPriorityQueue {
    protected $serial = PHP_INT_MAX;
    public function insert($value, $priority) {
        parent::insert($value, array($priority, $this->serial--));
    }
}

?>

<< Back to user notes page

To Top