note 80717 deleted from simplexmlelement.addChild by danbrown
| From: | danbrown@php.net | Date: | Fri, 28 Jan 2011 14:34:33 +0000 |
| Subject: | note 80717 deleted from simplexmlelement.addChild by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-176463@lists.php.net to get a copy of this message | ||
Note Submitter: danz at gethitz dot info
----
Object cloning ...
So using the 'clone' keyword here lets you work on $new separately, and attributes added
to $new don't show up in $sxe
without the 'clone' all changes to $new will be reflected in the larger $sxe tree
<?php
$new = clone $sxe->AddChild("comment",$comment);
$new->AddAttribute("name",$name);
$new->AddAttribute("url",$url);
$new->AddAttribute("ip",$ip);
$new->AddAttribute("time",$time);
?>