downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

SplQueue::enqueue> <SplQueue::__construct
[edit] Last updated: Fri, 24 May 2013

view this page in

SplQueue::dequeue

(PHP 5 >= 5.3.0)

SplQueue::dequeueDequeues a node from the queue

Açıklama

mixed SplQueue::dequeue ( void )

Dequeues value from the top of the queue.

Bilginize:

SplQueue::dequeue() is an alias of SplDoublyLinkedList::shift().

Değiştirgeler

Bu işlevin değiştirgesi yoktur.

Dönen Değerler

The value of the dequeued node.



add a note add a note User Contributed Notes SplQueue::dequeue - [2 notes]
up
1
andresdzphp at php dot net
1 year ago
<?php
$q
= new SplQueue();
$q->setIteratorMode(SplQueue::IT_MODE_DELETE);
$q->enqueue('item 1');
$q->enqueue('item 2');
$q->enqueue('item 3');

$q->dequeue();
$q->dequeue();

foreach (
$q as $item) {
    echo
$item;
}

//Result: item 3

$q->dequeue(); //Fatal error: Uncaught exception 'RuntimeException'
              //with message 'Can't shift from an empty datastructure'
?>
up
0
xuecan at gmail dot com
3 years ago
If the queue is empty, dequeue() will raise an 'RuntimeException' with message 'Can't shift from an empty datastructure'.

 
show source | credits | sitemap | contact | advertising | mirror sites