pqueue_003.phpt 437 B

12345678910111213141516171819202122232425262728
  1. --TEST--
  2. SPL: SplPriorityQueue: iteration through methods
  3. --FILE--
  4. <?php
  5. $h = new SplPriorityQueue();
  6. $h->insert(1, 1);
  7. $h->insert(5, 5);
  8. $h->insert(0, 0);
  9. $h->insert(4, 4);
  10. $h->rewind();
  11. echo "count(\$h) = ".count($h)."\n";
  12. echo "\$h->count() = ".$h->count()."\n";
  13. while ($h->valid()) {
  14. $k = $h->key();
  15. $v = $h->current();
  16. echo "$k=>$v\n";
  17. $h->next();
  18. }
  19. ?>
  20. --EXPECT--
  21. count($h) = 4
  22. $h->count() = 4
  23. 3=>5
  24. 2=>4
  25. 1=>1
  26. 0=>0