You are here: Create a hard return in the textfile after writing to a textfile???? « PHP Language « IT news, forums, messages
Create a hard return in the textfile after writing to a textfile????

Posted by Raoul van Hal on 01/11/06 14:09

I want to create a m3u playlist. I've created a while loop to write the
string to the textfile.
But after each token there needs to be a hard return in the textfile. Can
someone help me with this?


<?php
if (isset($_GET['lijst'])) {

$playlist = $_GET['lijst'];
$m3ufile = fopen("music/test.m3u", "ab");
$tok = strtok ($playlist, "^");

while ($tok) {
if ($tok != "") {
echo "<br> $tok" ;
fwrite($m3ufile, $tok);
$tok = strtok ("^");
} else {
$tok = strtok ("^");

}
}
fclose($m3ufile);

}
?>

This is the output in the m3ufile :

beatwalking.mp3 DJ Pilze - Birdshitonblackshoe.mp3 DJ Pilze - 1st-jungle.mp3
DJ Pilze - 1st-jungle.mp3 DJ Pilze - herewego.mp3

and it needs to be :

beatwalking.mp3
DJ Pilze - Birdshitonblackshoe.mp3
DJ Pilze - 1st-jungle.mp3
DJ Pilze - 1st-jungle.mp3
DJ Pilze - herewego.mp3


As you can see there is a newline after each song.

I appreciate the help,

Greetings raoul

Still learning :-)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация