friends i managed to make following output from a php code
0 0 1 0 2 0 0
0 0 0 0 0 0 3
1 0 0 1 0 2 0
0 0 1 0 0 0 3
2 0 0 0 0 0 0
0 0 2 0 0 0 0
0 3 0 3 0 0 0
1==>3 3==>4 4==>7 7==>2 3==>6 1==>5
<html>
<?php
// Start XML file, create parent node
$dom = new DOMDocument("1.0");
$node = $dom->createElement("markers");
$parnode = $dom->appendChild($node);
$result= array(array(0,0,1,0,2,0,0),array(0,0,0,0,0,0,3),array(1,0,0,1,0,2,0),
array(0,0,1,0,0,0,3),array(2,0,0,0,0,0,0),array(0,0,2,0,0,0,0),
array(0,3,0,3,0,0,0));
echo "<pre>";
for($k = 0; $k < 7; $k++){
for($j = 0; $j < 7; $j++){
echo $result[$k][$j],"\t";
}
echo "\n<br>";
}
$sum=0;
for($i = 0; $i < 7; $i++){
for($j = 0; $j < 7; $j++){
$sum += $result[$i][$j];
}
}
while( $sum > 0)
{
$i = 0;
while($i < 7){
$j=0;
while($j<7)
{
hm: if($result[$i][$j]!=0)
{ echo $i+1;
print "==>";
$result[$i][$j]=0;
$result[$j][$i]=0;
$i=$j;
$j=0;
echo $i+1;
print " ";
goto hm;
}
$j++;
}
$i++;
}
$sum=0;
for($i = 0; $i < 7; $i++){
for($j = 0; $j < 7; $j++){
$sum += $result[$i][$j];
}
}
}
//..................................................................
?>
</html>
EXPECTED OUTPUT
<markers>
<marker from="1" to="3"/>
<marker from="3" to="4"/>
<marker from="4" to="7"/>
<marker from="7" to="2"/>
<marker from="3" to="6"/>
<marker from="1" to="5"/>
</markers>