1--TEST-- 2DOMDocument::saveHTMLFile() should dump the internal document into a file using HTML formatting 3--CREDITS-- 4Knut Urdalen <knut@php.net> 5#PHPTestFest2009 Norway 2009-06-09 \o/ 6--EXTENSIONS-- 7dom 8--SKIPIF-- 9<?php 10if (LIBXML_VERSION < 21300) die("skip see https://gitlab.gnome.org/GNOME/libxml2/-/issues/756"); 11?> 12--FILE-- 13<?php 14$filename = __DIR__."/DOMDocument_saveHTMLFile_basic_gte_2_13.html"; 15$doc = new DOMDocument('1.0'); 16$root = $doc->createElement('html'); 17$root = $doc->appendChild($root); 18$head = $doc->createElement('head'); 19$head = $root->appendChild($head); 20$title = $doc->createElement('title'); 21$title = $head->appendChild($title); 22$text = $doc->createTextNode('This is the title'); 23$text = $title->appendChild($text); 24$bytes = $doc->saveHTMLFile($filename); 25var_dump($bytes); 26echo file_get_contents($filename); 27unlink($filename); 28?> 29--EXPECT-- 30int(59) 31<html><head><title>This is the title</title></head></html> 32