php8.5
Home/ Manual/ dom / domdocument/ DOMDocument::createComment

DOMDocument::createComment

PHP function Edit on GitHub ✎

(PHP 5, PHP 7, PHP 8)

Create new comment node

Description

DOMDocument::createComment(string $data): DOMComment

This function creates a new instance of class DOMComment. Inserted

Parameters

data

The content of the comment.

Return Values

The new DOMComment.

Changelog

VersionDescription
8.1.0In case of an error, a DomException is thrown now. Previously, false was returned.

See Also

  • DOMNode::appendChild
  • DOMDocument::createAttribute
  • DOMDocument::createAttributeNS
  • DOMDocument::createCDATASection
  • DOMDocument::createDocumentFragment
  • DOMDocument::createElement
  • DOMDocument::createElementNS
  • DOMDocument::createEntityReference
  • DOMDocument::createProcessingInstruction
  • DOMDocument::createTextNode

Source: reference/dom/domdocument/createcomment.xml · from the official PHP manual (php/doc-en)