Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<Dom\HTMLDocument::createFromStringDom\HTMLDocument::saveHtmlFile>
^Dom\HTMLDocumentLast updated: Mon, 26 Oct 2026

Dom\HTMLDocument::saveHtml

(PHP 8 >= 8.4.0)

Dom\HTMLDocument::saveHtml — Serializes the document as an HTML string

Description

public function Dom\HTMLDocument::saveHtml(?Dom\Node $node = null): string

Serializes the document as an HTML string.

Parameters

node

The node to serialize. If not provided, the entire document is serialized.

Return Values

The serialized HTML document string in the current document encoding.

Errors/Exceptions

See Also


<Dom\HTMLDocument::createFromStringDom\HTMLDocument::saveHtmlFile>
^Dom\HTMLDocumentLast updated: Mon, 26 Oct 2026