This is a specific problem I got and can't understand what I did wrong. Don't flag this question again because of "possible duplicate" because I KNOW how to open and print out a file. This is not what I'm asking for.
This is my txt file:
onceagain|Tristam - Once Again.mp3|gh|Tristam|Once Again;
seksikeks|AContrari - SEKS I KEKS.mp3|dubstep|AContrari|SEKS I KEKS;
blue|Au5 Fractal - Blue.mp3|drumstep|Au5 & Fractal|Blue;
airplanes|B.O.B - Airplanes (Feint Remix).mp3|dnb|B.O.B.|Airplanes (Feint Remix);
sea|Camellia - Flying in the Flow of Deep-Sea.mp3|dubstep|Camellia|Flying in the Flow of Deep-Sea;
onslaught|CENOB1TE - Onslaught.mp3|dubstep|CENOB1TE|Onslaught;
snakeeyes|Feint - Snake Eyes (feat. CoMa).mp3|drumstep|Feint|Snake Eyes (feat. CoMa);
wontbealone|Feint - We Won't Be Alone (feat. Laura Brehm).mp3|dnb|Feint|We Won't Be Alone (feat. Laura Brehm);
vine|Tristam - The Vine.mp3|drumstep|Tristam|The Vine;
frameofmind|Tristam & Braken - Frame of Mind.mp3|dnb|Tristam & Braken|Frame of Mind;
heist|Noisestorm - Heist.mp3|trap|Noisestorm|Heist;
I could print out everthing, but I want to print them out using for
loop, because I will be puting everything in seperate variables later:
$myfile = fopen("songs.txt", "r");
$songs = fread($myfile,filesize("songs.txt"));
$lines = count(file("songs.txt")) - 1;
for ($x = 0; $x <= $lines; $x++) {
echo strtok($songs, ";");
$songs = strstr($songs, ';');
}
Unfortunately, this is what output i recieve:
onceagain|Tristam - Once Again.mp3|gh|Tristam|Once Again
seksikeks|AContrari - SEKS I KEKS.mp3|dubstep|AContrari|SEKS I KEKS
seksikeks|AContrari - SEKS I KEKS.mp3|dubstep|AContrari|SEKS I KEKS
seksikeks|AContrari - SEKS I KEKS.mp3|dubstep|AContrari|SEKS I KEKS
seksikeks|AContrari - SEKS I KEKS.mp3|dubstep|AContrari|SEKS I KEKS
seksikeks|AContrari - SEKS I KEKS.mp3|dubstep|AContrari|SEKS I KEKS
seksikeks|AContrari - SEKS I KEKS.mp3|dubstep|AContrari|SEKS I KEKS
seksikeks|AContrari - SEKS I KEKS.mp3|dubstep|AContrari|SEKS I KEKS
seksikeks|AContrari - SEKS I KEKS.mp3|dubstep|AContrari|SEKS I KEKS
seksikeks|AContrari - SEKS I KEKS.mp3|dubstep|AContrari|SEKS I KEKS
seksikeks|AContrari - SEKS I KEKS.mp3|dubstep|AContrari|SEKS I KEKS
I need this to be fixed.