php8.5
Home/ Manual/ reference / ds/ The Stack class

The Stack class

A Stack is a “last in, first out” or “LIFO” collection that only allows access to the value at the top of the structure and iterates in that order, destructively.

Intro

A Stack is a “last in, first out” or “LIFO” collection that only allows access to the value at the top of the structure and iterates in that order, destructively.

Uses a Ds\Vector internally.

Class synopsis

class Ds\Stack { }

Changelog

VersionDescription
PECL ds 1.3.0The class now implements ArrayAccess.

Stack

Source: reference/ds/ds.stack.xml · from the official PHP manual (php/doc-en)