xref: /PHP-7.4/ext/spl/tests/pqueue_003.phpt (revision ded3d984)
1--TEST--
2SPL: SplPriorityQueue: iteration through methods
3--FILE--
4<?php
5$h = new SplPriorityQueue();
6
7$h->insert(1, 1);
8$h->insert(5, 5);
9$h->insert(0, 0);
10$h->insert(4, 4);
11
12$h->rewind();
13echo "count(\$h) = ".count($h)."\n";
14echo "\$h->count() = ".$h->count()."\n";
15while ($h->valid()) {
16    $k = $h->key();
17    $v = $h->current();
18    echo "$k=>$v\n";
19    $h->next();
20}
21?>
22===DONE===
23<?php exit(0); ?>
24--EXPECT--
25count($h) = 4
26$h->count() = 4
273=>5
282=>4
291=>1
300=>0
31===DONE===
32