DOMDocument_saveHTML_basic.phpt 649 B

12345678910111213141516171819202122
  1. --TEST--
  2. DOMDocument::saveHTML() should dump the internal document into a string using HTML formatting
  3. --CREDITS--
  4. Knut Urdalen <knut@php.net>
  5. #PHPTestFest2009 Norway 2009-06-09 \o/
  6. --EXTENSIONS--
  7. dom
  8. --FILE--
  9. <?php
  10. $doc = new DOMDocument('1.0');
  11. $root = $doc->createElement('html');
  12. $root = $doc->appendChild($root);
  13. $head = $doc->createElement('head');
  14. $head = $root->appendChild($head);
  15. $title = $doc->createElement('title');
  16. $title = $head->appendChild($title);
  17. $text = $doc->createTextNode('This is the title');
  18. $text = $title->appendChild($text);
  19. echo $doc->saveHTML();
  20. ?>
  21. --EXPECT--
  22. <html><head><title>This is the title</title></head></html>