(PHP 8 >= 8.4.0)
Represents an HTML document.
public static createEmpty(string $encoding = "UTF-8"): Dom\HTMLDocument
public static createFromFile(string $path, int $options = 0, ?string $overrideEncoding = null): Dom\HTMLDocument
public static createFromString(string $source, int $options = 0, ?string $overrideEncoding = null): Dom\HTMLDocument
public saveHtml(?Dom\Node $node = null): string
public saveHtmlFile(string $filename): int|false
public saveXml(?Dom\Node $node = null, int $options = 0): string|false
public saveXmlFile(string $filename, int $options = 0): int|false
Note: The DOM extension uses UTF-8 encoding when working with methods or properties. The parser methods auto-detect the encoding or allow the caller to specify an encoding.
© 1997–2025 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://www.php.net/manual/en/class.dom-htmldocument.php