note 103268 deleted from book.simplexml by danbrown
| From: | danbrown@php.net | Date: | Tue, 05 Apr 2011 15:05:03 +0000 |
| Subject: | note 103268 deleted from book.simplexml by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-178515@lists.php.net to get a copy of this message | ||
Note Submitter: s dot volkomorov at gmail dot com
----
marcus dot garcia at uol dot com dot br posted a rather useful function, but I would change the
following lines
<?php
if(!is_array($arr[$nodeName]['value']))
{
$arr[$nodeName]['value'][] = array_shift($arr[$nodeName]);
$arr[$nodeName]['attributes'][] = array_shift($arr[$nodeName]['attributes']);
}
?>
to
<?php
if(!is_array($arr[$nodeName]['value']))
{
$arr[$nodeName]['value'][] = array_shift($arr[$nodeName]);
$arr[$nodeName]['attributes'] = Array($arr[$nodeName]['attributes']);
}
?>
because otherwise the resulting array is incorrect.