pqueue_003.phpt 478 B

12345678910111213141516171819202122232425262728293031
  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. ===DONE===
  21. <?php exit(0); ?>
  22. --EXPECTF--
  23. count($h) = 4
  24. $h->count() = 4
  25. 3=>5
  26. 2=>4
  27. 1=>1
  28. 0=>0
  29. ===DONE===