Convert PHP Array to XML

Input data

This form allows you convert PHP array to XML, you only need to insert the array syntax [...] or array(...), paste or upload your array below:


Your result can be seen below.

Result of converting a PHP array to XML

Move to "Paste Code" for Save it

About PHP array conversion to XML

About this tool

The Convert PHP array to XML was created for online converting array of PHP into appropriate XML. This can come in handy for testing or debugging your arrays, also for fast formatting and adding XML document to your config or anywhere else.

How it Works?

Just paste your PHP array to the textarea above and click to the button "Convert" and you will get XML in the next textarea. PHP array should be without variables and functions, there should be a clean syntax like [...] or array(...).

Example of conversion PHP array to XML

Before:
[
  'first_section' => [
    'one' => '1',
    'test' => 'sample',
    'job' => 'DEVELOPER',
  ],
  'second_section' => [
    'path' => '/var/test',
    'URL' => 'https://wtools.io/',
    'second_section' => [
      'one' => '1 associated',
      'two' => '2 associated',
      0 => '1 unassociated',
      1 => '2 unassociated',
    ],
  ],
  'third_section' => [
    'version' => ['7.0','7.1','7.2','7.3'],
  ],
]
After:
<?xml version="1.0"?>
<root>
	<first_section>
		<one>1</one>
		<test>sample</test>
		<job>DEVELOPER</job>
	</first_section>
	<second_section>
		<path>/var/test</path>
		<URL>https://wtools.io/</URL>
		<second_section>
			<one>1 associated</one>
			<two>2 associated</two>
			<item0>1 unassociated</item0>
			<item1>2 unassociated</item1>
		</second_section>
	</second_section>
	<third_section>
		<version>
			<item0>7.0</item0>
			<item1>7.1</item1>
			<item2>7.2</item2>
			<item3>7.3</item3>
		</version>
	</third_section>
</root>
After the conversion, you can apply the XML to your project or use it for some other purpose.