Add new child at the end of the children in PHP

Description

The following code shows how to add new child at the end of the children.

Example


/*from  w  ww . j ava2  s . c  o  m*/
<?php

$doc = new DOMDocument;

$node = $doc->createElement("para");
$newnode = $doc->appendChild($node);

echo $doc->saveXML();
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    XML »




DOM
SimpleXML
SimpleXMLElement
XML Parser