array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'de', ), 'this' => array ( 0 => 'domelement.remove.php', 1 => 'DOMElement::remove', 2 => 'Removes the element', ), 'up' => array ( 0 => 'class.domelement.php', 1 => 'DOMElement', ), 'prev' => array ( 0 => 'domelement.prepend.php', 1 => 'DOMElement::prepend', ), 'next' => array ( 0 => 'domelement.removeattribute.php', 1 => 'DOMElement::removeAttribute', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/dom/domelement/remove.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

DOMElement::remove

(PHP 8)

DOMElement::removeRemoves the element

Beschreibung

public DOMElement::remove(): void

Removes the element.

Parameter-Liste

Diese Funktion besitzt keine Parameter.

Rückgabewerte

Es wird kein Wert zurückgegeben.

Beispiele

Beispiel #1 DOMElement::remove() example

Removes the element.

<?php
$doc
= new DOMDocument;
$doc->loadXML("<container><hello/><world/></container>");
$hello = $doc->documentElement->firstChild;

$hello->remove();

echo
$doc->saveXML();
?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

<?xml version="1.0"?>
<container><world/></container>

Siehe auch