I need to get the sum total of a sub-child element from mxl file My structure of xml file is as follow
<pagevalues>
<ac>
<b1>1</b1>
<b2>2</b2>
<b3>3</b3>
<b4>4</b4>
<b5>5</b5>
<pc>6</pc>
</ac>
<pagevalues>
I tried following approach but get Total =0
$xml = simplexml_load_file($target_url);
$total=0;
foreach($xml->ac as $data)
{
$total += $data;
}
echo 'Total is: ' . $total;