I know how to put content to child element I google and can't find solution to put content to sub-child element. I have following structure in my xml file
<pagevalues>
<ac>
<acb1/>
<acb2/>
<acb3/>
<acb4/>
<acb5/>
<acpc/>
</ac>
........
.....
</pagevalues>
this is the code to put value in xml file
$xml->$ac = $actotal;
file_put_contents("$url", $xml->asXML());