Im having trouble getting the type of song in an xml file. First off I am loading in the XML file using
$xmlDoc = file_get_contents('/songs.xml');
once the file has been loaded into a string I explode them into an array using
$songs = explode("<song>", $xmlDoc);
I have tried using a foreach loop to step through each song then exploding the type, however this isn't giving me just the type it's including Rock</type>.
songs.xml
<songs>
    <song>
        <title>Paradise City</title>
        <artist>Guns & Roses</artist>
        <type>Rock</type>
    </song>
    <song>
        <title>One Love</title>
        <artist>Bob Marley</artist>
        <type>Reggae</type>
    </song>
    <song>
        <title>Sweet Child Mine</title>
        <artist>Guns & Roses</artist>
        <type>rock</type>
    </song>
</songs>
 
    