1--TEST-- 2DOMDocument::saveHTMLFile() should format output on demand 3--CREDITS-- 4Knut Urdalen <knut@php.net> 5#PHPTestFest2009 Norway 2009-06-09 \o/ 6--SKIPIF-- 7<?php 8require_once dirname(__FILE__) .'/skipif.inc'; 9?> 10--FILE-- 11<?php 12$filename = dirname(__FILE__)."/tmp_savehtmlfile".time().".html"; 13$doc = new DOMDocument('1.0'); 14$doc->formatOutput = true; 15$root = $doc->createElement('html'); 16$root = $doc->appendChild($root); 17$head = $doc->createElement('head'); 18$head = $root->appendChild($head); 19$title = $doc->createElement('title'); 20$title = $head->appendChild($title); 21$text = $doc->createTextNode('This is the title'); 22$text = $title->appendChild($text); 23$bytes = $doc->saveHTMLFile($filename); 24var_dump($bytes); 25echo file_get_contents($filename); 26unlink($filename); 27?> 28--EXPECT-- 29int(129) 30<html><head> 31<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 32<title>This is the title</title> 33</head></html> 34