This is probably a really simple thing to do, but I'm struggling. I've got a CSV file formatted like so;
"Afrojack","The Spark"
"All About She","Higher"
"Banks","This Is What It Feels Like"
"Bastille","Of The Night"
"Basto!","Gregory's Theme"
What I want to do is, load this data using PHP so that I can call the first and second items individually within a foreach loop. For example (the above data is an artist, and then a track name);
foreach (*this is also where I'm stuck*) {
echo "Artist: $artist <br/>";
echo "Track: $track <br />;
}
I'm not really a PHP guy, so I'd usually do this in javascript and use JSON, but in this instance it needs to be CSV and PHP :(
Can someone help point me in the right direction?
Thank you!
As you only asked for a point in the right direction, here you go: fgetcsv
.