Documentation
SPHPlayground manual
sphplayground
sphplayground

Standard library: Datastructures

The Standard PHP Library (SPL) provides a set of standard data structures, and there is also a PECL package Efficient data structures for PHP 7 available for some systems. SPHP framework introduces a few extensions and add-ons to this set.

The Collection: A jack of all trades

This class provides an implementation of CollectionInterface.

Stack: a (LIFO) data structure

In computer science a stack represents a last in, first out (LIFO) data structure. The ArrayStack implements the Stack interface.

Queue: a (FIFO) data structure

In computer science, a queue represents a First-In-First-Out (FIFO) data.

Basic Queue implementation

The ArrayQueue is a simple implementation of the Queue interface. It uses PHP arrays as its inner data structure.

The PriorityQueue class

A priority queue is stable if deletions of items with equal priority value occur in the order in which they were inserted.

The PriorityQueue class solves the stability problem of the SplPriorityQueue class. Thus The PriorityQueue is stable.

The Vector class

A Vector is a sequence of values in a contiguous buffer that grows and shrinks automatically

Execution sequence

ExecutionSequence is a prioritized queue of callables that can be executed in the order of their priorities.