DOMProcessingInstruction->__construct()
(PHP 5)
DOMProcessingInstruction->__construct() — Crea un nuovo oggetto DOMProcessingInstruction
Descrizione
DOMProcessingInstruction
__construct
( string $name
[, string $value
] )
Crea un nuovo oggetto DOMProcessingInstruction. Questo oggetto è in sola lettura. Può essere aggiunto al documento, ma non possono essere inseriti nodi aggiuntivi fino a quando il nodo è associato al documento. Per creare un nodo modificabile utilizzare DOMDocument->createProcessingInstruction().
Elenco dei parametri
- name
-
Nome del tag dell'istruzione di processamento.
- value
-
Valore dell'istruzione di processamento.
Esempi
Example#1 Creazione di un nuovo DOMProcessingInstruction
<?php
$dom = new DOMDocument('1.0', 'UTF-8');
$html = $dom->appendChild(new DOMElement('html'));
$body = $html->appendChild(new DOMElement('body'));
$pinode = new DOMProcessingInstruction('php', 'echo "Hello World"; ');
$body->appendChild($pinode);
echo $dom->saveXML(); /* <?xml version="1.0" encoding="iso-8859-1"?>
<html><body><?php echo "Hello World"; ?></body></html> */
?>