ok i have a text file… that users add text to all the time…
what i want to do is… to check everytime to see the file size and if the text file size gets greater than 50 kb
then i want to leave the first 12 lines… but cut the rest of the text from lines 13 onwards till how manyever lines are there then create another text file (if the file doesnt exist )… **old_data.txt ** if it exsits jsut paste the remaning lines into that file… at the top
this is what i have so far
$fp = fopen('data.txt', 'r');
$size = 0;
if ($fp) {
while (!feof($fp))
$size += strlen(fread($fp, 4096));
fclose($fp);
if ($size >= 50000) {
flock($fp,2);
$old_f = fread($fp, filesize($file));
// i would have to enter the rest in here...
flock(fp,3);
}
}
i cant figure out the remaning part… how too go to the 13th line and copy them and paste them in another file
please help