Usephul

Stack

Table of Contents

Methods

pop()  : TValue|null
Pop the element off the end of this {@see ArrayMap}.
push()  : int
Push one or more elements onto the end of this Map.
shift()  : mixed
Shift an element off the beginning.
unshift()  : mixed

Methods

pop()

Pop the element off the end of this {@see ArrayMap}.

public pop() : TValue|null

Pops and returns the value of the last element of this ArrayMap, shortening the ArrayMap by one element.

Note:

This function will ArrayMap::reset() the pointer of this ArrayMap after use.

Return values
TValue|null

Returns the value of the last element of this ArrayMap. If this ArrayMap is empty, null will be returned.

push()

Push one or more elements onto the end of this Map.

public push(mixed ...$values) : int

push() works as a stack, and Pushes the passed variables onto the end of it. The length is increases by the number of variables pushed.

Parameters
$values : mixed

The values to push onto the end of the Stack.

Return values
int

Returns the new number of elements.

shift()

Shift an element off the beginning.

public shift() : mixed

Shifts the first value of this ArrayMap off and returns it, shortening this ArrayMap by one element and moving everything down. All numerical keys will be modified to start counting from zero while literal keys won't be affected.

Note: This function will reset the pointer of this ArrayMap after use.

Return values
mixed

Returns the shifted value, or null if this ArrayMap is empty.

unshift()

public unshift() : mixed

        
On this page

Search results