note 89643 deleted from function.var-dump by thiago
| From: | thiago@php.net | Date: | Tue, 17 Mar 2009 18:20:01 +0000 |
| Subject: | note 89643 deleted from function.var-dump by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-152060@lists.php.net to get a copy of this message | ||
Note Submitter: ldmc at yahoo dot com
----
Simple way to add a text node:
$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.