array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'uk', ), 'this' => array ( 0 => 'domchildnode.replacewith.php', 1 => 'DOMChildNode::replaceWith', 2 => 'Replaces the node with new nodes', ), 'up' => array ( 0 => 'class.domchildnode.php', 1 => 'DOMChildNode', ), 'prev' => array ( 0 => 'domchildnode.remove.php', 1 => 'DOMChildNode::remove', ), 'next' => array ( 0 => 'class.domcomment.php', 1 => 'DOMComment', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/dom/domchildnode/replacewith.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

DOMChildNode::replaceWith

(PHP 8)

DOMChildNode::replaceWithReplaces the node with new nodes

Опис

public DOMChildNode::replaceWith(DOMNode|string ...$nodes): void

Replaces the node with new nodes.

Параметри

nodes

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

Значення, що повертаються

Не повертає значень.

Помилки/виключення

DOM_HIERARCHY_REQUEST_ERR

Виникає, якщо тип батьківського вузла не дозволяє тип дочірнього вузла, котрий передано в параметр nodes, або якщо вузол, який потрібно додати, є одним із предків цього вузла або ним самим.

DOM_WRONG_DOCUMENT_ERR

Виникає, якщо один з переданих nodes було створено не в тому документі, що і цей вузол.

Журнал змін

Версія Опис
8.3.0 Calling this method on a node without a parent is now a no-op to align the behaviour with the DOM specification. Раніше викидалося виключення DOMException з кодом DOM_HIERARCHY_REQUEST_ERR.

Прогляньте також