Removes the character data node

# Dom\CharacterData::remove

(PHP 8 >= 8.4.0)

Dom\CharacterData::remove — Removes the character data node

### 说明

public function Dom\CharacterData::remove(): void

Removes the character data node.

### 参数

此函数没有参数。

### 返回值

没有返回值。

### 示例

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

以上示例会输出：

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

### 参见

- Dom\ChildNode::remove() - Removes the node
- Dom\CharacterData::after() - Adds nodes after the character data
- Dom\CharacterData::before() - Adds nodes before the character data
- Dom\CharacterData::replaceWith() - Replaces the character data with new nodes
- Dom\Node::removeChild()

`↑` and `↓` to navigate • `Enter` to select • `Esc` to close • `/` to open