Apr 18 2008

I found an interesting helper function today through the PHPDeveloper.org feed.

It’s as simple as the topic suggests - it’s a function that takes an XML formatted string and returns an array containing the results. Using the example from Michael’s msbware.com:

Example source XML:

<xmlData>
<author>
<name>John Doe</name>
<magazine>Time</magazine>
<magazine>National Geographic</magazine>
</author>
</xmlData>

Example result array with:

[xmlData][author][name] => John Doe
[xmlData][author][magazine][0] => Time
[xmlData][author][magazine][1] => National Geographic

Leave a Reply