xref: /PHP-8.3/ext/spl/tests/heap_007.phpt (revision a555cc0b)
1--TEST--
2SPL: SplHeap: iteration through methods
3--FILE--
4<?php
5$h = new SplMaxHeap();
6
7$h->insert(1);
8$h->insert(5);
9$h->insert(0);
10$h->insert(4);
11
12$h->rewind();
13echo "count(\$h) = ".count($h)."\n";
14echo "\$h->count() = ".$h->count()."\n";
15
16while ($h->valid()) {
17    $k = $h->key();
18    $v = $h->current();
19    echo "$k=>$v\n";
20    $h->next();
21}
22?>
23--EXPECT--
24count($h) = 4
25$h->count() = 4
263=>5
272=>4
281=>1
290=>0
30