<question>What is php ?</question>
     <0>Server SIde Lang.</0>
     <1>client side lang</1>

    //This is my xml File. 
    // Bt I want When <ansIndex> is 0 then set attribute in  <0 true>,<ansIndex> is 1 then   <1 true> 

    //how i can do this?
    //my Php code is


$array = json_decode($_GET['data'],true);
function array_to_xml($array, &$xml_user_info) {
    foreach($array as $key => $value) {
        if(is_array($value)) {
                $subnode = $xml_user_info->addChild("$key");
                array_to_xml($value, $subnode);
                $subnode = $xml_user_info->addChild("item$key");
                array_to_xml($value, $subnode);
        }else {

$xml_user_info = new SimpleXMLElement("<?xml version=\"1.0\"?><root></root>");
$xml_file = $xml_user_info->asXML('users.xml');

Member Avatar


This is directly related to your last thread. Please keep questions within the thread if they are related. Otherwise you end up flooding the forum.

lps answered your question in this thread:


But you did not reply (again), but simply started a new thread. Please, don't start any more threads until this line of questioning and answering has been exhausted. If your question is on a totally different point and nothing to do with snippets of code you have already posted, fine, but otherwise, just leave the 'Start New Discussion' button alone.

can u Help Me to solve this ....:-(

Member Avatar


Unfortunately I'm busy and am only cleaning up forum mess at the moment. Maybe lps will help you, but you may have run the risk of alienating him as starting a new thread instead of responding to a well-crafted solution, which I imagine took some considerable time to write, is a bit of a slap to the face. Hopefully he (or somebody else) will come along.

yup it's my mistake ..so next time i memoried it...