SplDoublyLinkedList_lifoMode.phpt 407 B

1234567891011121314151617181920212223
  1. --TEST--
  2. Check that SplDoublyLinkedList can traverse backwards
  3. --CREDITS--
  4. Rob Knight <themanhimself@robknight.org.uk> PHPNW Test Fest 2009
  5. --FILE--
  6. <?php
  7. $list = new SplDoublyLinkedList();
  8. $list->push('o');
  9. $list->push('o');
  10. $list->push('f');
  11. $list->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO);
  12. $list->rewind();
  13. while ($tmp = $list->current()) {
  14. echo $tmp;
  15. $list->next();
  16. }
  17. ?>
  18. --EXPECT--
  19. foo