note 89644 modified in simplexmlelement.addchild by danbrown

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

« previous php.notes (#161070) next »