XML to PHP Array Converter
Convert XML markup into exportable PHP array literals with short or long syntax.
Export XML as PHP array literals
Parse XML and generate copy-ready PHP array syntax for fixtures, config bootstrapping, or unit tests.
Choose short [] or long array() style and optionally wrap the result in a $variable assignment.
Also try INI to PHP Array Converter, CSV to PHP Array Converter, and PHP Array to XML Converter for the reverse direction.
Frequently Asked Questions
How are numbers and booleans handled?
XML text nodes that look numeric or boolean are emitted as PHP numbers and true/false literals when the parser coerces types.
What about XML attributes?
Attributes are included by default with an @_ key prefix. Toggle “Ignore XML attributes” to omit them.
Is the XML sent to a server?
No. Conversion is performed locally in your browser.