xref: /PHP-5.5/ext/spl/tests/dllist_003.phpt (revision 3a4eb3e4)
1--TEST--
2SPL: DoublyLinkedList: iterator modes
3--FILE--
4<?php
5$dll = new SplDoublyLinkedList();
6$dll->push(2);
7$dll->push(3);
8$dll->push(4);
9
10$dll->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO);
11
12foreach ($dll as $k => $v) {
13    echo "$k=>$v\n";
14}
15
16$dll->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO);
17foreach ($dll as $k => $v) {
18    echo "$k=>$v\n";
19}
20
21$dll->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO | SplDoublyLinkedList::IT_MODE_DELETE);
22var_dump($dll->count());
23foreach ($dll as $k => $v) {
24    echo "$k=>$v\n";
25}
26var_dump($dll->count());
27
28?>
29===DONE===
30<?php exit(0); ?>
31--EXPECTF--
322=>4
331=>3
340=>2
350=>2
361=>3
372=>4
38int(3)
390=>2
400=>3
410=>4
42int(0)
43===DONE===
44