I\'m creating a xml using this
$customXML = new SimpleXMLElement(\' \');
after adding some attributes onto this, when
There's another way without the replacing xml header. I prefer this:
$xml = new xmlWriter();
$xml->openMemory();
$xml->startElement('abc');
$xml->writeAttribute('id', 332);
$xml->startElement('params');
$xml->startElement('param');
$xml->writeAttribute('name', 'aa');
$xml->text('33');
$xml->endElement();
$xml->endElement();
echo $xml->outputMemory(true);
Gives output:
33