note 87742 deleted from function.simplexml-element-addChild by danbrown

From: Date: Wed, 16 Sep 2009 16:37:54 +0000
Subject: note 87742 deleted from function.simplexml-element-addChild by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-160735@lists.php.net to get a copy of this message
Note Submitter: Nicholas Rawlings @Skookum (Concord, NC) ---- Here's an easy way to add a text node to a SimpleXMLElement without having to bring DOM into play: <?php $element = new SimpleXMLElement('<exclamation/>'); $element->addChild('//', 'Amazing!'); echo $element->asXML(); // <exclamation>Amazing!</exclamation> ?> Not sure if this qualifies as an undocumented feature or an overlooked bug (please comment), but it seems useful enough to me.

« previous php.notes (#160735) next »