--- title: Document::save --- Document::save — Serializes the DOM tree into a file ## Description ## ```php public Document::save ( string $filename , null $options = null ) : int|false ``` Creates an HTML document from the DOM representation. ## Parameters ##
filename
The path to the saved HTML document
options
Always null. Was used for option constants in \DOMDocument.
## Return Values ## Returns the number of bytes written or false on failure. ## Examples ## **Example \#1 Saving a DOM tree into a file** ```php loadHTML('Ook!

Eek

'); echo 'Wrote: ' . $dom->save('/tmp/test.html') . ' bytes'; // Wrote: 85 bytes ?> ```