note 85925 deleted from function.simplexml-element-addChild by danbrown
| From: | danbrown@php.net | Date: | Wed, 16 Sep 2009 16:38:12 +0000 |
| Subject: | note 85925 deleted from function.simplexml-element-addChild by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-160738@lists.php.net to get a copy of this message | ||
Note Submitter: zspencer at zacharyspencer dot com
----
Interesting to note, when passing an empty value into addChild (For instance from a null result from
a database query) it assumes that you want to have an actual node instead of a string value.
Example:
<?php
$empty_node='';
$xml = new SimpleXMLElement('<xml></xml>');
$xml->addChild('empty_node',$empty_node);
print_r($xml);
/*
SimpleXMLElement Object
{
[empty_node] => SimpleXMLElement Object
{
[0] =>
}
}
*/
?>
I haven't figured out a way around this yet, any hints?