phpday 2027 - Call for Papers

The SplMaxHeap class

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

Introduction

The SplMaxHeap class provides the main functionalities of a heap, keeping the maximum on the top.

Class synopsis

class SplMaxHeap extends SplHeap {
/* Methods */
protected function compare(mixed $value1, mixed $value2): int
/* Inherited methods */
protected function SplHeap::compare(mixed $value1, mixed $value2): int
public function SplHeap::count(): int
public function SplHeap::current(): mixed
public function SplHeap::extract(): mixed
public function SplHeap::insert(mixed $value): true
public function SplHeap::isCorrupted(): bool
public function SplHeap::isEmpty(): bool
public function SplHeap::key(): int
public function SplHeap::next(): void
public function SplHeap::rewind(): void
public function SplHeap::top(): mixed
public function SplHeap::valid(): bool
}

Table of Contents

  • SplMaxHeap::compare — Compare elements in order to place them correctly in the heap while sifting up

User Contributed Notes

There are no user contributed notes for this page.
Adding new notes is disabled. Please see the links in the Found A Problem? section.
To Top