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

Dom\HTMLDocument::createEmpty

(PHP 8 >= 8.4.0)

Dom\HTMLDocument::createEmptyCreates an empty HTML document

Descrizione

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

Creates an empty HTML document without any elements.

Elenco dei parametri

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

Valori restituiti

An empty HTML document.

Esempi

Example #1 Dom\HTMLDocument::createEmpty() example

Creates an empty document and serializes it.

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

Il precedente esempio visualizzerà:

string(0) ""

Vedere anche:

To Top