blob: 0eff4aa0362bfefb19c938125c479684f4afb67a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
--TEST--
SPL: DoublyLinkedList: iterator modes
--FILE--
<?php
$dll = new SplDoublyLinkedList();
$dll->push(2);
$dll->push(3);
$dll->push(4);
$dll->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO);
foreach ($dll as $k => $v) {
echo "$k=>$v\n";
}
$dll->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO);
foreach ($dll as $k => $v) {
echo "$k=>$v\n";
}
$dll->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO | SplDoublyLinkedList::IT_MODE_DELETE);
var_dump($dll->count());
foreach ($dll as $k => $v) {
echo "$k=>$v\n";
}
var_dump($dll->count());
?>
--EXPECT--
2=>4
1=>3
0=>2
0=>2
1=>3
2=>4
int(3)
0=>2
0=>3
0=>4
int(0)
|