php8.5
Home/ Manual/ dom / htmldocument/ Dom\HTMLDocument::saveHtml

Dom\HTMLDocument::saveHtml

PHP function Edit on GitHub ✎

(PHP 8 >= 8.4.0)

Serializes the document as an HTML string

Description

Dom\HTMLDocument::saveHtml(Dom\Node|null $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::saveHtmlFile
  • Dom\HTMLDocument::saveXml

Source: reference/dom/dom/htmldocument/savehtml.xml · from the official PHP manual (php/doc-en)