3v4l.org

run code in 300+ PHP versions simultaneously
<?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());
Output for 5.1.3 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
<?xml version="1.0"?> <xml><track><path>song1.mp3</path><title>Track 1 - Track Title</title></track><track><path>song2.mp3</path><title>Track 2 - Track Title</title></track><track><path>song3.mp3</path><title>Track 3 - Track Title</title></track><track><path>song4.mp3</path><title>Track 4 - Track Title</title></track><track><path>song5.mp3</path><title>Track 5 - Track Title</title></track><track><path>song6.mp3</path><title>Track 6 - Track Title</title></track><track><path>song7.mp3</path><title>Track 7 - Track Title</title></track><track><path>song8.mp3</path><title>Track 8 - Track Title</title></track></xml>
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.2
Fatal error: Call to undefined method SimpleXMLElement::addChild() in /in/3iIop on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
Fatal error: Cannot instantiate non-existent class: simplexmlelement in /in/3iIop on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: simplexmlelement in /in/3iIop on line 2

preferences:
254.81 ms | 401 KiB | 370 Q