php8.5
Home/ Manual/ dom / domchildnode/ DOMChildNode::after

DOMChildNode::after

PHP function Edit on GitHub ✎

(PHP 8)

Adds nodes after the node

Description

DOMChildNode::after(DOMNode|string ...$nodes): void

Adds the passed nodes after the node.

Parameters

nodes

Nodes to be added after the node. Strings are automatically converted to text nodes.

Return Values

Void

Errors/Exceptions

Changelog

VersionDescription
8.3.0Calling this method on a node without a parent is now a no-op to align the behaviour with the DOM specification. Previous_hierarchy_exception
8.3.0Calling this method on a node without an owner document now works. Previous_hierarchy_exception

See Also

  • DOMChildNode::before
  • DOMChildNode::remove
  • DOMChildNode::replaceWith
  • DOMNode::appendChild

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