What is the function saveHTML used for in PHP?

The saveHTML function in PHP is used to save the HTML content of a DOMDocument object to a file. This function is useful when you want to store the HTML content generated by manipulating the DOMDocument object in a file for later use or reference.

<?php
// Create a new DOMDocument object
$doc = new DOMDocument();

// Load HTML content into the DOMDocument object
$doc->loadHTML('<html><body><h1>Hello, World!</h1></body></html>');

// Save the HTML content to a file named output.html
$doc->saveHTMLFile('output.html');
?>