note 80717 modified in function.simplexml-element-addChild by danbrown

From: Date: Wed, 16 Sep 2009 16:38:40 +0000
Subject: note 80717 modified in function.simplexml-element-addChild by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-160742@lists.php.net to get a copy of this message
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); ?> --was-- 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); ?> http://php.net/manual/en/function.simplexml-element-addChild.php

« previous php.notes (#160742) next »