The SplPriorityQueue class

Introduction

The SplPriorityQueue class provides the main functionalities of a prioritized queue, implemented using a max heap.

Note: The order of elements with identical priority is undefined. It may differ from the order in which they have been inserted.

Class synopsis

SplPriorityQueue
implements Iterator Countable
/* Constants */
public const int SplPriorityQueue::EXTR_BOTH;
public const int SplPriorityQueue::EXTR_PRIORITY;
public const int SplPriorityQueue::EXTR_DATA;
/* Methods */
public int compare(mixed $priority1, mixed $priority2)
public int count()
public mixed current()
public mixed extract()
public int getExtractFlags()
public true insert(mixed $value, mixed $priority)
public bool isCorrupted()
public bool isEmpty()
public int key()
public void next()
public true recoverFromCorruption()
public void rewind()
public int setExtractFlags(int $flags)
public mixed top()
public bool valid()

Predefined Constants

SplPriorityQueue::EXTR_BOTH

SplPriorityQueue::EXTR_PRIORITY

SplPriorityQueue::EXTR_DATA

Table of Contents