Created
July 14, 2017 00:13
-
-
Save mateusneves/0e55a744e0823c283d8be3f2d5073db3 to your computer and use it in GitHub Desktop.
Generate XML with PHP
This file contains hidden or 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 | |
$xml = new SimpleXMLElement('<xml/>'); | |
for ($i = 1; $i <= 8; ++$i) { | |
$track = $xml->addChild('track'); | |
$track->addChild('path', "song$i.mp3"); | |
$track->addChild('title', "Track $i - Track Title"); | |
} | |
Header('Content-type: text/xml'); | |
print($xml->asXML()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment