(PHP 8)
DOMCharacterData::remove — Removes the character data node
public DOMCharacterData::remove(): void
Removes the character data node.
This function has no parameters.
No value is returned.
Example #1 DOMCharacterData::remove() example
Removes the character data.
<?php
$doc = new DOMDocument;
$doc->loadXML("<container><![CDATA[hello]]><world/></container>");
$cdata = $doc->documentElement->firstChild;
$cdata->remove();
echo $doc->saveXML();
?> The above example will output:
<?xml version="1.0"?> <container><world/></container>
© 1997–2025 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://www.php.net/manual/en/domcharacterdata.remove.php