title: How to remove SimpleXMLElement Object from php array
body: <p>I have read xml file using <code>simplexml_load_file</code> php function.</p>
  
  <p>I have store xml data into php array but in some array its display array of xml <code>like SimpleXMLElement Object ( [0] =&gt; some value )</code></p>
  
  <p>When I am print xml data , its display properly but when I am assign xml value to php array its display as above xml object in array </p>
  
  <p><strong>XML</strong></p>
  
  <pre><code>&lt;data&gt;
      &lt;request&gt;
          &lt;type&gt;City&lt;/type&gt;
          &lt;query&gt;Anand, India&lt;/query&gt;
      &lt;/request&gt;
      &lt;current_condition&gt;
          &lt;observation_time&gt;08:55 AM&lt;/observation_time&gt;
          &lt;temp_C&gt;28&lt;/temp_C&gt;
          &lt;temp_F&gt;82&lt;/temp_F&gt;
          &lt;weatherCode&gt;113&lt;/weatherCode&gt;            
          &lt;weatherDesc&gt;Sunny&lt;/weatherDesc&gt;
          &lt;windspeedMiles&gt;9&lt;/windspeedMiles&gt;
          &lt;windspeedKmph&gt;14&lt;/windspeedKmph&gt;
          &lt;winddirDegree&gt;63&lt;/winddirDegree&gt;
          &lt;winddir16Point&gt;ENE&lt;/winddir16Point&gt;
          &lt;precipMM&gt;0.0&lt;/precipMM&gt;
          &lt;humidity&gt;23&lt;/humidity&gt;
          &lt;visibility&gt;10&lt;/visibility&gt;
          &lt;pressure&gt;1014&lt;/pressure&gt;
          &lt;cloudcover&gt;0&lt;/cloudcover&gt;
      &lt;/current_condition&gt;
          &lt;weather&gt;
              &lt;date&gt;2012-12-22&lt;/date&gt;
              &lt;tempMaxC&gt;33&lt;/tempMaxC&gt;
              &lt;tempMaxF&gt;91&lt;/tempMaxF&gt;
              &lt;tempMinC&gt;18&lt;/tempMinC&gt;
              &lt;tempMinF&gt;64&lt;/tempMinF&gt;
              &lt;windspeedMiles&gt;11&lt;/windspeedMiles&gt;
              &lt;windspeedKmph&gt;17&lt;/windspeedKmph&gt;
              &lt;winddirection&gt;ENE&lt;/winddirection&gt;
              &lt;winddir16Point&gt;ENE&lt;/winddir16Point&gt;
              &lt;winddirDegree&gt;63&lt;/winddirDegree&gt;
              &lt;weatherCode&gt;113&lt;/weatherCode&gt;
              &lt;weatherDesc&gt;Sunny&lt;/weatherDesc&gt;
              &lt;precipMM&gt;0.0&lt;/precipMM&gt;
          &lt;/weather&gt;
          &lt;weather&gt;
              &lt;date&gt;2012-12-23&lt;/date&gt;
              &lt;tempMaxC&gt;34&lt;/tempMaxC&gt;
              &lt;tempMaxF&gt;92&lt;/tempMaxF&gt;
              &lt;tempMinC&gt;18&lt;/tempMinC&gt;
              &lt;tempMinF&gt;65&lt;/tempMinF&gt;
              &lt;windspeedMiles&gt;9&lt;/windspeedMiles&gt;
              &lt;windspeedKmph&gt;15&lt;/windspeedKmph&gt;
              &lt;winddirection&gt;ENE&lt;/winddirection&gt;
              &lt;winddir16Point&gt;ENE&lt;/winddir16Point&gt;
              &lt;winddirDegree&gt;64&lt;/winddirDegree&gt;
              &lt;weatherCode&gt;113&lt;/weatherCode&gt;
              &lt;weatherDesc&gt;Sunny&lt;/weatherDesc&gt;
              &lt;precipMM&gt;0.0&lt;/precipMM&gt;
          &lt;/weather&gt;
          &lt;weather&gt;
              &lt;date&gt;2012-12-24&lt;/date&gt;
              &lt;tempMaxC&gt;33&lt;/tempMaxC&gt;
              &lt;tempMaxF&gt;92&lt;/tempMaxF&gt;
              &lt;tempMinC&gt;18&lt;/tempMinC&gt;
              &lt;tempMinF&gt;64&lt;/tempMinF&gt;
              &lt;windspeedMiles&gt;9&lt;/windspeedMiles&gt;
              &lt;windspeedKmph&gt;14&lt;/windspeedKmph&gt;
              &lt;winddirection&gt;NE&lt;/winddirection&gt;
              &lt;winddir16Point&gt;NE&lt;/winddir16Point&gt;
              &lt;winddirDegree&gt;45&lt;/winddirDegree&gt;
              &lt;weatherCode&gt;113&lt;/weatherCode&gt;
              &lt;weatherDesc&gt;Sunny&lt;/weatherDesc&gt;
              &lt;precipMM&gt;0.0&lt;/precipMM&gt;
          &lt;/weather&gt;
      &lt;/data&gt;
  </code></pre>
  
  <p><strong>PHP:</strong></p>
  
  <pre><code>$child=$xml-&gt;children();
  foreach($xml-&gt;children() as $child)
  {               
      foreach($child-&gt;children() as $child_t)
      { 
          $weather_arr[$child_t-&gt;getName()]=$child_t;
          echo $child_t-&gt;getName() . ": " . $child_t . "&lt;br /&gt;";   
  
      }
  }
  
  echo "&lt;pre&gt;".html_entity_decode(print_r($weather_arr,true))."&lt;/pre&gt;";
  </code></pre>