You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
521 B

21 years ago
21 years ago
  1. --TEST--
  2. SPL: CachingIterator::hasNext()
  3. --FILE--
  4. <?php
  5. $ar = array(1, 2, array(31, 32, array(331)), 4);
  6. $it = new RecursiveArrayIterator($ar);
  7. $it = new RecursiveCachingIterator($it);
  8. $it = new RecursiveIteratorIterator($it);
  9. foreach($it as $k=>$v)
  10. {
  11. echo "$k=>$v\n";
  12. echo "hasNext: " . ($it->getInnerIterator()->hasNext() ? "yes" : "no") . "\n";
  13. }
  14. ?>
  15. ===DONE===
  16. <?php exit(0); ?>
  17. --EXPECTF--
  18. 0=>1
  19. hasNext: yes
  20. 1=>2
  21. hasNext: yes
  22. 0=>31
  23. hasNext: yes
  24. 1=>32
  25. hasNext: yes
  26. 0=>331
  27. hasNext: no
  28. 3=>4
  29. hasNext: no
  30. ===DONE===