Thanks, but I don't know how to delete older lines, that's my problem (I am a newbie).
I currently use this to add new text:
<?php
$fcontents = join ( '', file ( "chat.txt"));
$fp = fopen ("chat.txt", "w");
$newchat = StripSlashes($newchat); //stop slash being added in front of appostrophess
fwrite ($fp, "$newchat\n"); //writes new chat to file
fwrite ($fp, $fcontents); // add previous content after new content
fclose ($fp);
?>
This is working great, now what do I need to add so it only keeps, say, the first 20 lines in the text file?
Thanks
Dave