I am trying to make a loop that will output xml rows in the php script. The values come from comma separated variable like following:
$commaValues = '5773270,5778216';
$lubuvnaCommas = explode(',', $commaValues);
foreach($lubuvnaCommas as $row){
$expected = $row;
$destinations = "<cl_id>".$expected."</cl_id>";
}
the destination variable should be outputted in the defined xml structure in my script like following:
$xml ='
<?xml version="1.0" encoding="UTF-8"?>
<destinations>
'.$destinations.'
</destinations>;
this means the final output of the xml data should look like following:
$xml ='
<?xml version="1.0" encoding="UTF-8"?>
<destinations>
<cl_id>5773270</cl_id>
<cl_id>5778216</cl_id>
</destinations>';
I tried many options, i feel there is something missing in my loop that doesn't output a loop of xml data.