XML-string-to-PHP-array icon indicating copy to clipboard operation
XML-string-to-PHP-array copied to clipboard

Hoe can XML-string-to-PHP-array be modified so always an array is returned?

Open cvlug opened this issue 9 years ago • 0 comments

When kids have multiple kid, kids is returned as array: <show name="Family Guy"> <dog>Brian</dog> <kids> <kid>Chris</kid> <kid>Meg</kid> </kids> </show> </tv> gives: `[kids] => Array ( [kid] => Array ( [0] => Chris [1] => Meg )

            )`

When kids has 1 kid, kids is returned as name=> value: <tv> <show name="Family Guy"> <dog>Brian</dog> <kids> <kid>Chris</kid> </kids> </show> </tv> gives: [kids] => Array ( [kid] => Chris

This makes processing of output of XML-string-to-PHP-array harder. Hoe can XML-string-to-PHP-array be modified so always an array is returned?

cvlug avatar Oct 21 '16 10:10 cvlug