PHP 8.5.0 Beta 2 available for testing

Dom\HTMLDocument::createEmpty

(PHP 8 >= 8.4.0)

Dom\HTMLDocument::createEmptyCreates an empty HTML document

説明

public static 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) ""

参考

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top