Location: PHPKode > scripts > SimpleXML for PHP4 > intermediate.txt
The XML File : 

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE myfile>
<myfile>
	<!-- Sample comment -->
	<subbranch>Sample XML element</subbranch>
	<longsubbranch>Sample XML element containing a lot of text, enough to be put on a separate line.</longsubbranch>
	<parentofmany attribute="value" otherattribute="other&lt;value&gt;">
		<child>matters not</child>
		<child>matters not</child>

	</parentofmany>
	<parentofmany>
		<child><![CDATA[ Contents of <CDATA> block ]]></child>
		<child><underchild>matters not</underchild></child>
	</parentofmany>
</myfile>

The Output : 

Array
(
    [subbranch] => Sample XML element
    [longsubbranch] => Sample XML element containing a lot of text, enough to be put on a separate line.
    [parentofmany] => Array
        (
            [0] => Array
                (
                    [@attributes] => Array
                        (
                            [attribute] => value
                            [otherattribute] => other
                        )

                    [child] => Array
                        (
                            [0] => matters not
                            [1] => matters not
                        )

                )

            [1] => Array
                (
                    [child] => Array
                        (
                            [0] =>  Contents of  block 
                            [1] => Array
                                (
                                    [underchild] => matters not
                                )

                        )

                )

        )

)
Return current item: SimpleXML for PHP4