note 47561 deleted from ref.simplexml by aidan
| From: | aidan@php.net | Date: | Wed, 22 Dec 2004 07:24:35 +0000 |
| Subject: | note 47561 deleted from ref.simplexml by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-82156@lists.php.net to get a copy of this message | ||
Note Submitter: dummyusr at hm dot com
----
modification of that simplexml_to_array function
problem with example:
xml:
<Actor>Daniel Radcliffe</Actor>
<Actor>Rupert Grint</Actor>
<Actor>Emma Watson (II)</Actor>
result:
[Actor] => Array
(
[0] => Array
(
[0] => Daniel Radcliffe
[1] => Rupert Grint
)
[1] => Emma Watson (II)
)
EXPECTED result:
[Actor] => Array
(
[0] => Daniel Radcliffe
[1] => Rupert Grint
[2] => Emma Watson (II)
)
SOLUTION:
replace the line: <? elseif (is_array($ar[$k][0])) { ?>
with this: <? elseif (@in_array(0,@array_keys($ar[$k]))) { ?>