I am using this function http://mysrc.blogspot.it/2007/02/php-xml-to-array-and-backwards.html to parse an XML to an Array. Very great function. But the strange thing is that if I have the following 2 xml files:
<response>
<company prop1=1>
</company>
<company prop1=2>
</company>
</response>
<response>
<company prop1=1>
</company>
</response>
I got different result. For the first case, I got an array of two elements:
Array(
int(0) => _a => Array(...)
int(1) => _a => Array(...)
)
but for the second case I got
Array (
_a => Array(...)
)
which is not an array with indexes as the first case. This complicates parsing. Does anybody have any idea how to modify the code? Regards.