update page now
PHP 8.2.30 Released!

DOMCdataSection::__construct

(PHP 5, PHP 7, PHP 8)

DOMCdataSection::__constructConstruye un nuevo objeto DOMCdataSection

Descripción

public DOMCdataSection::__construct(string $data)

Construye un nuevo nodo CDATA. Funciona igual que la clase DOMText.

Parámetros

data

El valor del nodo CDATA. Si no se proporciona, se crea un nodo CDATA vacío.

Ejemplos

Ejemplo #1 Crear un nuevo objeto DOMCdataSection

<?php

$dom
= new DOMDocument('1.0', 'utf-8');
$elemento = $dom->appendChild(new DOMElement('root'));
$texto = $elemento->appendChild(new DOMCdataSection('root value'));
echo
$dom->saveXML();

?>

El ejemplo anterior mostrará:

<?xml version="1.0" encoding="utf-8"?>
<root><![CDATA[root value]]></root>

Ver también

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant