3v4l.org

run code in 200+ PHP versions simultaneously
<?php $xml = new XMLWriter(); $xml->openMemory(); var_dump($xml->startElement('element')); var_dump($xml->writeAttribute('attr1', 0)); var_dump($xml->writeElement('subelem', 0)); var_dump($xml->writeAttribute('attr2', 0)); var_dump($xml->endElement());
based on Uh60i
Output for 5.6.0 - 7.2.6
bool(true) bool(true) bool(true) bool(false) bool(true)