note 94720 deleted from simplexmlelement.addChild by danbrown
| From: | danbrown@php.net | Date: | Fri, 28 Jan 2011 14:34:18 +0000 |
| Subject: | note 94720 deleted from simplexmlelement.addChild by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-176455@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
To add another XML-Element including one or more Tags instead of just one Tag, use this recursive
function:
<?php
function AddXMLElement(SimpleXMLElement $dest, SimpleXMLElement $source)
{
$new_dest = $dest->addChild($source->getName(), $source[0]);
foreach ($source->children() as $child)
{
AddXMLElement($new_dest, $child);
}
}
?>