Skip to content

Instantly share code, notes, and snippets.

@bayleedev
Created January 16, 2013 20:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bayleedev/4550484 to your computer and use it in GitHub Desktop.
Save bayleedev/4550484 to your computer and use it in GitHub Desktop.
<?php
Media::type('xml', 'application/xml', array(
'layout' => false,
'encode' => function($data) {
$xml = new SimpleXMLElement('<root/>');
array_walk_recursive($data, array($xml, 'addChild'));
return $xml->asXML();
},
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment