I'm trying to loop multiple items from an XML with the code below.
$xml = get_data('the-url');
$data = simplexml_load_string($xml);
foreach($data->item AS $item) {
    foreach($item AS $test) {
        var_dump($test);
    }
}
The XML looks like this:
<xml>
    <item>
        <name>...</name>
        <chapter>...</chapter>
        <text>
            ...
        </text>
    </item>
    <item>
        <name>...</name>
        <chapter>...</chapter>
        <text>
            ...
        </text>
    </item>
    <item>
        <name>...</name>
        <chapter>...</chapter>
        <text>
            ...
        </text>
    </item>
    <item>
        <name>...</name>
        <chapter>...</chapter>
        <text>
            ...
        </text>
    </item>
    <item>
        <name>...</name>
        <chapter>...</chapter>
        <text>
            ...
        </text>
    </item>
</xml>
As it is right now, the var_dump($test) prints this:
object(SimpleXMLElement)#7 (0) { } object(SimpleXMLElement)#8 (0) { }
object(SimpleXMLElement)#7 (0) { } object(SimpleXMLElement)#8 (0) { }
object(SimpleXMLElement)#7 (0) { } object(SimpleXMLElement)#8 (0) { }
object(SimpleXMLElement)#7 (0) { } object(SimpleXMLElement)#8 (0) { }
object(SimpleXMLElement)#7 (0) { } object(SimpleXMLElement)#8 (0) { }
object(SimpleXMLElement)#7 (0) { } object(SimpleXMLElement)#8 (0) { }
object(SimpleXMLElement)#7 (0) { } object(SimpleXMLElement)#8 (0) { } ...
What should I do to make my code to loop all the items and prints the value?
 
    