$str = "Test Artist Test - Test Title Test";
$trackinfo = preg_split('/-/', $str);
exec('metamp3 --title '.$trackinfo[1].' --artist '.$trackinfo[0].' track.mp3');
This is a cut of the code I am using, basically I'm obviously doing something wrong (I'm quite new to PHP and don't really understand some of the conventions used. When I run this line, from what I can see it would only put Test and Test for the title and artist (like it is only taking the first word from the string) but if I was to do something like
print_r $trackinfo; print $trackinfo[1]; print $trackinfo[0];
I can clearly see that the split string is formatted correctly, I was wondering if someone could explain what exactly is going on here and how I would go about fixing it?
Thanks!