php8.5
Home/ Manual/ dom / domparentnode/ DOMParentNode::prepend

DOMParentNode::prepend

PHP function Edit on GitHub ✎

(PHP 8)

Prepends nodes before the first child node

Description

DOMParentNode::prepend(DOMNode|string ...$nodes): void

Prepends one or many nodes to the list of children before the first child node.

Parameters

nodes

The nodes to prepend. Strings are automatically converted to text nodes.

Return Values

Void

Errors/Exceptions

Changelog

VersionDescription
8.3.0Calling this method on a node without an owner document now works. Previous_hierarchy_exception

See Also

  • DOMParentNode::append

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