Dom\HTMLDocument::createEmpty
PHP Manual
PHP Manual»Dom\HTMLDocument»Dom\HTMLDocument::createEmpty

Dom\HTMLDocument::createEmpty

(PHP 8 >= 8.4.0)

Dom\HTMLDocument::createEmpty — Creates an empty HTML document

Опис

public static function Dom\HTMLDocument::createEmpty(string $encoding = "UTF-8"): Dom\HTMLDocument

Creates an empty HTML document without any elements.

Параметри

encoding

The character encoding of the document, used for serialization when calling the save methods.

Значення, що повертаються

An empty HTML document.

Приклади

Приклад #1 Dom\HTMLDocument::createEmpty() example

Creates an empty document and serializes it.

<?php
$dom = Dom\HTMLDocument::createEmpty();
var_dump($dom->saveHtml());
?>

Поданий вище приклад виведе:

string(0) ""

Прогляньте також

To Top