mirror of
https://github.com/php/php-src.git
synced 2024-10-20 16:02:44 +00:00
32 lines
451 B
Plaintext
32 lines
451 B
Plaintext
|
--TEST--
|
||
|
SPL: SplHeap: iteration through methods
|
||
|
--FILE--
|
||
|
<?php
|
||
|
$h = new SplMaxHeap();
|
||
|
|
||
|
$h->insert(1);
|
||
|
$h->insert(5);
|
||
|
$h->insert(0);
|
||
|
$h->insert(4);
|
||
|
|
||
|
$h->rewind();
|
||
|
echo "count(\$h) = ".count($h)."\n";
|
||
|
echo "\$h->count() = ".$h->count()."\n";
|
||
|
while ($h->valid()) {
|
||
|
$k = $h->key();
|
||
|
$v = $h->current();
|
||
|
echo "$k=>$v\n";
|
||
|
$h->next();
|
||
|
}
|
||
|
?>
|
||
|
===DONE===
|
||
|
<?php exit(0); ?>
|
||
|
--EXPECTF--
|
||
|
count($h) = 4
|
||
|
$h->count() = 4
|
||
|
4=>5
|
||
|
3=>4
|
||
|
2=>1
|
||
|
1=>0
|
||
|
===DONE===
|