Instantly share code, notes, and snippets.

Embed
What would you like to do?
Array to Xml
<?php
header("Content-Type: text/xml");
$array = array (
'10.10.10.10' => 'Server'
);
$xml = new SimpleXMLElement('<root/>');
array_walk_recursive($array, array ($xml, 'addChild'));
print $xml->asXML();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment