SplQueue::setIteratorMode
SplHeap::compare
Datastructures
PHP Manual

# The SplHeap class

## Introduction

The SplHeap class provides the main functionalities of an Heap.

## Class synopsis

SplHeap
abstract SplHeap implements Iterator , Countable {
/* Methods */
SplHeap::__construct ( void )
abstract int SplHeap::compare ( mixed `$value1` , mixed `$value2` )
int SplHeap::count ( void )
mixed SplHeap::current ( void )
mixed SplHeap::extract ( void )
void SplHeap::insert ( mixed `$value` )
bool SplHeap::isEmpty ( void )
mixed SplHeap::key ( void )
void SplHeap::next ( void )
void SplHeap::recoverFromCorruption ( void )
void SplHeap::rewind ( void )
mixed SplHeap::top ( void )
bool SplHeap::valid ( void )
}

## Table of Contents

- SplHeap::compare — Compare elements in order to place them correctly in the heap while sifting up.
- SplHeap::__construct — Constructs a new empty heap
- SplHeap::count — Counts the number of elements in the heap.
- SplHeap::current — Return current node pointed by the iterator
- SplHeap::extract — Extracts a node from top of the heap and sift up.
- SplHeap::insert — Inserts an element in the heap by sifting it up.
- SplHeap::isEmpty — Checks whether the heap is empty.
- SplHeap::key — Return current node index
- SplHeap::next — Move to the next node
- SplHeap::recoverFromCorruption — Recover from the corrupted state and allow further actions on the heap.
- SplHeap::rewind — Rewind iterator back to the start (no-op)
- SplHeap::top — Peaks at the node from the top of the heap
- SplHeap::valid — Check whether the heap contains more nodes

SplQueue::setIteratorMode
SplHeap::compare
Datastructures
PHP Manual