Created
October 26, 2015 07:45
-
-
Save iredun/cabf09d628ba6131ea1f to your computer and use it in GitHub Desktop.
Array to Xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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