php8.5
Home/ Manual/ xmlwriter / xmlwriter/ XMLWriter::startDocument

XMLWriter::startDocument

PHP function Edit on GitHub ✎

(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL xmlwriter >= 0.1.0)

Create document tag

Description

Oop

XMLWriter::startDocument(string|null $version = "1.0", string|null $encoding = null, string|null $standalone = null): bool

Procedural

xmlwriter_start_document(XMLWriter $writer, string|null $version = "1.0", string|null $encoding = null, string|null $standalone = null): bool

Starts a document.

Parameters

version

The version number of the document as part of the XML declaration.

encoding

The encoding of the document as part of the XML declaration.

standalone

yes or no.

Return Values

Success

Errors/Exceptions

Passing an encoding containing null bytes will throw a ValueError.

Changelog

VersionDescription
8.4.0Passing an encoding containing null bytes will now throw a ValueError.

See Also

  • XMLWriter::endDocument

Source: reference/xmlwriter/xmlwriter/startdocument.xml · from the official PHP manual (php/doc-en)