xref: /PHP-5.3/ext/spl/tests/heap_007.phpt (revision 16de7fbd)
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===DONE===
24<?php exit(0); ?>
25--EXPECTF--
26count($h) = 4
27$h->count() = 4
283=>5
292=>4
301=>1
310=>0
32===DONE===
33