PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?php
foreach($OpenPlayList as $k => $v){
if($k<200){ //if you want to make sure the file never get over 200 lines
$v = trim($v)."\n"; //nasty whitespace and carriage return bug in file()
fwrite($handle,$v);
}
}
fclose($handle);
?>
<?php
// Change this if you rename your playlist.txt file
$file = "playlist.txt";
// Get the contents of the current playlist file
$plarr = file($file);
if(count($plarr)>30)
{
$no_files_2_del = count($plarr)-30;
for($i=$no_files_2_del;$i>0;$i--)
array_pop($plarr);
$handle = fopen($file,"w");
foreach($plarr as $v)
{fwrite($handle,$v);}
fclose($handle);
}
else echo "File contains Entries less that or eqaul 30";
?>