<?php


if ($xml) {
    $valorTotal = 0.0;
    
    foreach ($xml->NFe->infNFe->det as $det) {
        $valorTotal += (float) $det->prod->vLiq;
    }
    
    $precoXml = $valorTotal;

}else{
  $precoXml = 0.00;
}

}else{
  $precoXml = 0.00;
}
