xref: /PHP-8.1/ext/spl/tests/pqueue_003.phpt (revision a555cc0b)
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--EXPECT--
23count($h) = 4
24$h->count() = 4
253=>5
262=>4
271=>1
280=>0
29