<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Comments on snippet: 'read XML with PHP'</title>
    <description>Snipplr comments feed</description>
    <link>https://snipplr.com/</link>
    <lastBuildDate>Mon, 06 Apr 2026 15:23:48 +0000</lastBuildDate>
    <item>
      <title>koncept said on 05/Oct/2008</title>
      <link>https://snipplr.com/view/8722/read-xml-with-php</link>
      <description>&lt;p&gt;Quick way to convert it all into an array...&#13;
&#13;
&lt;pre&gt;&lt;code&gt;&#13;
&#13;
&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;</description>
      <pubDate>Sun, 05 Oct 2008 03:44:58 UTC</pubDate>
      <guid>https://snipplr.com/view/8722/read-xml-with-php</guid>
    </item>
    <item>
      <title>koncept said on 05/Oct/2008</title>
      <link>https://snipplr.com/view/8722/read-xml-with-php</link>
      <description>&lt;p&gt;Quick way to convert it all into an array...&#13;
&#13;
&lt;pre&gt;&lt;code&gt;&#13;
// PHP5&#13;
function XML2Array(SimpleXMLElement $sxe){&#13;
	static $array = array();&#13;
	foreach($sxe as $k =&gt; $v) {&#13;
		if(is_array($v)) {&#13;
			recurseXML($sxe[$k]);&#13;
		} elseif(is_object($v)) {&#13;
			$array[] = (array) $v;&#13;
		}&#13;
	}&#13;
	return $array;&#13;
}&#13;
&#13;
print_r(XML2Array(simplexml_load_string($xml)));&#13;
&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;</description>
      <pubDate>Sun, 05 Oct 2008 03:45:18 UTC</pubDate>
      <guid>https://snipplr.com/view/8722/read-xml-with-php</guid>
    </item>
  </channel>
</rss>
