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

From: Date: Wed, 16 Sep 2009 16:37:31 +0000
Subject: note 89644 modified in function.simplexml-element-addChild by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-160733@lists.php.net to get a copy of this message
Simple way to add a text node: <?php $x=simplexml_load_string('<test />'); $x->addAttribute('id','x01'); $x[0]='text node'; echo $x->asXML(); ?> Result: <?xml version="1.0"?> <test id="x01">text node</test> Any numeric array subscript (in this case 0) will work. --was-- Simple way to add a text node: <?php $x=simplexml_load_string('<test />'); $x->addAttribute('id','x01'); $x[0]='text node'; echo $x->asXML(); ?> Result: <?xml version="1.0"?> <test id="x01">text node</test> Any numeric array subscript (in this case 0) will work. http://php.net/manual/en/function.simplexml-element-addChild.php

« previous php.notes (#160733) next »