# The SplHeap class

(PHP 5 >= 5.3.0, PHP 7, PHP 8)

## Einführung

The SplHeap class provides the main functionalities of a Heap.

## Klassenbeschreibung

abstract class SplHeap implements Iterator, Countable {
/* Methoden */
protected function compare(mixed `$value1`, mixed `$value2`): int
public function count(): int
public function current(): mixed
public function extract(): mixed
public function insert(mixed `$value`): true
public function isCorrupted(): bool
public function isEmpty(): bool
public function key(): int
public function next(): void
public function recoverFromCorruption(): true
public function rewind(): void
public function top(): mixed
public function valid(): bool
}

## Inhaltsverzeichnis

- SplHeap::compare — Compare elements in order to place them correctly in the heap while sifting up
- 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::isCorrupted — Tells if the heap is in a corrupted state
- 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 — Peeks at the node from the top of the heap
- SplHeap::valid — Check whether the heap contains more nodes

`↑` and `↓` to navigate • `Enter` to select • `Esc` to close • `/` to open