The SplStack classIntroduction
The SplStack class provides the main functionalities of a stack implemented using a doubly linked list by
setting the iterator mode to Class synopsis
SplStack
extends
SplDoublyLinkedList
/* Inherited constants */
public
const
int
SplDoublyLinkedList::IT_MODE_LIFO;
public
const
int
SplDoublyLinkedList::IT_MODE_FIFO;
public
const
int
SplDoublyLinkedList::IT_MODE_DELETE;
public
const
int
SplDoublyLinkedList::IT_MODE_KEEP;
/* Inherited methods */
public void add(int
$index , mixed $value )public mixed bottom()
public int count()
public mixed current()
public int getIteratorMode()
public bool isEmpty()
public int key()
public void next()
public bool offsetExists(int
$index )public mixed offsetGet(int
$index )public void offsetSet(intnull
$index , mixed $value )public void offsetUnset(int
$index )public mixed pop()
public void prev()
public void push(mixed
$value )public void rewind()
public string serialize()
public int setIteratorMode(int
$mode )public mixed shift()
public mixed top()
public void unserialize(string
$data )public void unshift(mixed
$value )public bool valid()
Examples
Example #1 SplStack example
The above example will output: 3 2 1 |