This is my code,
$row=array(username=>'username',password=>'password');
$var=array_flip($row);
$xml = new SimpleXMLElement('<root/>');
array_walk_recursive($var, array ($xml, 'addChild'));
$result= $xml->asXML();
If username and password are different say 'abcd' & 'efgh' respectively, xml looks like this:
<root>
<username>abcd</username>
<password>efgh</password>
</root>
but if they are same say 'abcd', xml looks like this:
<root>
<password>abcd</password>
</root>
and I want that it should show like
<root>
<username>abcd</username>
<password>abcd</password>
</root>
So how can I solve that?