PHP 8.5.0 Beta 1 available for testing

Voting

: max(eight, five)?
(Example: nine)

The Note You're Voting On

Anonymous
1 year 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