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

search for in the

SplQueue::enqueue> <SplQueue::__construct
[edit] Last updated: Fri, 10 Feb 2012

view this page in

SplQueue::dequeue

(PHP 5 >= 5.3.0)

SplQueue::dequeueキューからノードを取り出す

説明

mixed SplQueue::dequeue ( void )

value をキューの先頭から取り出します。

注意:

SplQueue::dequeue()SplDoublyLinkedList::shift() のエイリアスです。

パラメータ

この関数にはパラメータはありません。

返り値

キューから取り出したノードの値を返します。



add a note add a note User Contributed Notes SplQueue::dequeue
andresdzphp at php dot net 30-Sep-2011 05:10
<?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'
?>
xuecan at gmail dot com 20-Jan-2010 01:57
If the queue is empty, dequeue() will raise an 'RuntimeException' with message 'Can't shift from an empty datastructure'.

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