1 2 3 4 5 6 7 8 9 10 11
<?php $xml = new XMLWriter; $xml->openMemory(); $xml->startDocument('1.0', 'UTF-8'); $xml->startElement("wololo"); $xml->writeAttribute("ver", "1.0"); $xml->endElement(); $xml->endDocument(); echo $xml->outputMemory(TRUE);
1 2
<?xml version="1.0" encoding="UTF-8"?> <wololo ver="1.0"/>