note 80717 modified in simplexmlelement.addchild by danbrown

From: Date: Fri, 25 Sep 2009 17:16:37 +0000
Subject: note 80717 modified in simplexmlelement.addchild by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-161075@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/simplexmlelement.addchild.php

« previous php.notes (#161075) next »