The SplQueue classIntroduction
The SplQueue class provides the main functionalities of a queue implemented using a doubly linked list by
setting the iterator mode to Class synopsis
SplQueue
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;
/* Methods */
public mixed SplQueue::dequeue()
public void SplQueue::enqueue(mixed
$value )/* 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 SplQueue example
The above example will output: 1 2 3 Example #2 Efficiently handling tasks with SplQueue
|