« Getting Flattr to play nice with your WordPress 3 setup Splitting up your Habari plugin in smaller logical modules »

Converting a simple XML snippet to an array

2010
14
December

The need to convert a snippet of XML to a PHP array is something you are bound to encounter if you develop in PHP and are making calls to web services. Since everything has to be mashable these days, this includes more or less every PHP developer out there.

So I thought I'd share a tiny code snippet that will convert simple XML snippets in to an array. Keep in mind that when I say simple I mean SIMPLE. It doesn't support attributes, namespaces or any other goodies.

I packed the snippet wrapped in a class for tidiness and published it on GitHub so go fetch: XmlToArray.php