title: complex XML to array in codeigniter
body: <p>I am getting complex XML as a response i need to convert in to an array, here is my sample complex XML</p>
  
  <pre><code>   &lt;?xml version="1.0" encoding="UTF-8"?&gt;
   &lt;Response xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
      &lt;SearchResult&gt;
    &lt;Result&gt;
       &lt;aaa&gt;string&lt;/aaa&gt;
       &lt;bbb&gt;string&lt;/bbb&gt;
       &lt;ccc&gt;
          &lt;ddd&gt;
             &lt;eee&gt;string&lt;/eee&gt;
             &lt;fff&gt;string&lt;/fff&gt;
          &lt;/ddd&gt;
          &lt;ddd&gt;
             &lt;eee&gt;string&lt;/eee&gt;
             &lt;fff&gt;string&lt;/fff&gt;
          &lt;/ddd&gt;
       &lt;/ccc&gt;
       &lt;ggg&gt;
          &lt;hhh&gt;
             &lt;iii&gt;string&lt;/iii&gt;
             &lt;eee&gt;string&lt;/eee&gt;
             &lt;jjj&gt;string&lt;/jjj&gt;
  
          &lt;/hhh&gt;
          &lt;hhh&gt;
             &lt;iii&gt;string&lt;/iii&gt;
             &lt;eee&gt;string&lt;/eee&gt;
             &lt;jjj&gt;string&lt;/jjj&gt;
  
          &lt;/hhh&gt;
       &lt;/ggg&gt;
       &lt;kkk&gt;
          &lt;hhh&gt;
             &lt;iii&gt;string&lt;/iii&gt;
             &lt;eee&gt;string&lt;/eee&gt;
             &lt;jjj&gt;string&lt;/jjj&gt;
  
          &lt;/hhh&gt;
       &lt;/kkk&gt;
       &lt;lll&gt;
          &lt;mmm&gt;string&lt;/mmm&gt;
          &lt;nnn&gt;string&lt;/nnn&gt;
          &lt;ooo&gt;string&lt;/ooo&gt;
  
       &lt;/lll&gt;
  
    &lt;/Result&gt;
  
  
      &lt;Result&gt;
     //same values as above 
      &lt;/Result&gt;
  
  
  
   &lt;Result&gt;
     //same values as above 
     &lt;/Result&gt;
  
      &lt;/SearchResult&gt; 
   &lt;/Response&gt;
  </code></pre>
  
  <p>I have tried simple XML but its not working, </p>
  
  <pre><code>    function xml2Array($xmlstring)
  {
      $xml = simplexml_load_string($xmlstring, "SimpleXMLElement", LIBXML_NOCDATA);
      $json = json_encode($xml);
      return json_decode($json,TRUE);
  }
  
  $arr = xml2Array($response);
  print_r($arr);
  </code></pre>
  
  <p>But it returns empty array please suggest with possible solution for this </p>