iterator_006.phpt 419 B

123456789101112131415161718192021222324
  1. --TEST--
  2. SPL: IteratorIterator and SimpleXMlElement
  3. --SKIPIF--
  4. <?php if (!extension_loaded('simplexml')) print "skip SimpleXML required"; ?>
  5. --FILE--
  6. <?php
  7. $root = simplexml_load_string(b'<?xml version="1.0"?>
  8. <root>
  9. <child>Hello</child>
  10. <child>World</child>
  11. </root>
  12. ');
  13. foreach (new IteratorIterator($root->child) as $child) {
  14. echo $child."\n";
  15. }
  16. ?>
  17. ===DONE===
  18. <?php exit(0); ?>
  19. --EXPECT--
  20. Hello
  21. World
  22. ===DONE===