I have the following xml:
<SONG>
<PLAYEDAT>1487812025</PLAYEDAT>
<TITLE>John Legend - Love Me Now</TITLE>
<METADATA>
<TIT2>John Legend - Love Me Now</TIT2>
</METADATA>
</SONG>
<SONG>
<PLAYEDAT>1487811800</PLAYEDAT>
<TITLE>Ed Sheeran - Sing</TITLE>
<METADATA>
<TIT2>Ed Sheeran - Sing</TIT2>
</METADATA>
</SONG>
<SONG>
<PLAYEDAT>1487811572</PLAYEDAT>
<TITLE>Maroon 5 - Animals</TITLE>
<METADATA>
<TIT2>Maroon 5 - Animals</TIT2>
</METADATA>
</SONG>
And the following php:
foreach ($songs->SONGHISTORY->SONG as $song){
$exp = explode(' - ', $song->TITLE);
$json[] = array(
'data' => $song->PLAYEDAT,
'artista' => $exp[0],
'musica' => $exp[1],
'itunes' => $song->TITLE
);
}
However, I have a problem, I can not select a specific SONG , would you like to select only the first SONG , how can I do this? >