(PHP 8 >= 8.4.0)
Dom\CharacterData::remove — Removes the character data node
This function has no parameters.
No value is returned.
Example #1 Dom\CharacterData::remove() example
Removes the character data.
<?php
$doc
=
Dom\XMLDocument
::
createFromString
(
"<container><![CDATA[hello]]><world/></container>"
);
$cdata
=
$doc
->
documentElement
->
firstChild
;
$cdata
->
remove
();
echo
$doc
->
saveXML
();
?>
The above example will output:
<?xml versionen="1.0"?> <container><world/></container>