I try to parse xml into arrays. I have got 2 types of incoming data: 1)
<rows>
<item>
<a>A</a>
<b>B</b>
</item>
<item>
<c>C</c>
<d>D</d>
</item>
</rows>
2)
<rows>
<item>
<e>E</e>
<f>F</f>
</item>
</rows>
I create an object of SimpleXMLElement and then convert it in array as in Converting a SimpleXML Object to an Array using first answer. The result in first case is
[ '0' => ['a' => 'A', 'b' => 'B'], '1' => ['c' => 'C', 'd' => 'D']].
The result in second case is ['e' => 'E', 'f' => 'F']
But I need a numeric key in second case [ '0' => ['e' => 'E', 'f' => 'F']]
How to fix it?