note 114336 added to class.splqueue
| From: | ManuManjunath | Date: | Mon, 10 Feb 2014 10:56:45 +0000 |
| Subject: | note 114336 added to class.splqueue | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-198444@lists.php.net to get a copy of this message | ||
SplQueue inherits from SplDoublyLinkedList. So, objects of SplQueue support methods push() and
pop(). But please be advised that if you use push() and pop() methods on a SplQueue object, it
behaves like a stack rather than a queue.
For example:
$q = new SplQueue();
$q->push(1);
$q->push(2);
$q->push(3);
$q->pop();
print_r($q);
Above code returns:
SplQueue Object
(
[flags:SplDoublyLinkedList:private] => 4
[dllist:SplDoublyLinkedList:private] => Array
(
[0] => 1
[1] => 2
)
)
Note that 3 got popped and *not* 1.
So, please make sure that you use only enqueue() and dequeue() methods on a SplQueue object and
*not* push() and pop().
----
Server IP: 103.21.58.61
Probable Submitter: 202.83.18.29
----
Manual Page -- http://php.net/manual/en/class.splqueue.php
Edit -- https://master.php.net/note/edit/114336
Del: integrated -- https://master.php.net/note/delete/114336/integrated
Del: useless -- https://master.php.net/note/delete/114336/useless
Del: bad code -- https://master.php.net/note/delete/114336/bad+code
Del: spam -- https://master.php.net/note/delete/114336/spam
Del: non-english -- https://master.php.net/note/delete/114336/non-english
Del: in docs -- https://master.php.net/note/delete/114336/in+docs
Del: other reasons-- https://master.php.net/note/delete/114336
Reject -- https://master.php.net/note/reject/114336
Search -- https://master.php.net/manage/user-notes.php