- print_r: documentation ( source)
<?php
$string = "<?xml version='1.0' encoding='UTF-8'?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>123</heading>
<body>Don't forget me this weekend!</body>
</note>
";
$sxe = new SimpleXMLElement($string);
$sxe->addAttribute('test', '2312');
echo $sxe->test;
print_r($sxe);