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