PHP 8.5.0 RC 2 available for testing

DOMElement::remove

(PHP 8)

DOMElement::removeRemoves the element

Description

public DOMElement::remove(): void

Removes the element.

Parameters

This function has no parameters.

Return Values

No value is returned.

Examples

Example #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();
?>

The above example will output:

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

See Also

Found A Problem?

Learn How To Improve This PageSubmit a Pull RequestReport a Bug
+add a note

User Contributed Notes

There are no user contributed notes for this page.

AltStyle によって変換されたページ (->オリジナル) /