Empty text file when there is over XXXX lines of text.


Posted on 16th Feb 2014 07:03 pm by admin


define("RANDOM_FILE","/public_html/random.txt");
$randomEntry = "This goes in text file.n";
{
$randomFile = fopen(RANDOM_FILE,"a");
}
fwrite($randomFile,$randomEntry);
fclose($randomFile);


This adds text to a random.txt file. How do you make it also empty the file when there is over say 1,000 lines of data?

Each line has 588 bytes of data, or 588K when it has 1,000 lines. How big does a text file need to be before it can slow the site down when the script looks for the random line?

No comments posted yet

Your Answer:

Login to answer
91 Like 5 Dislike
Previous forums Next forums
Other forums

Connecion issue
Hi,

For some reason, I keep getting this error when trying to connect:

Warning: mysql_

Socket Server
In my following socket server, I am trying to listen to a connection through port 12345 in my web br

parsing error
can anyone explain this syntax error:

Parse error: syntax error, unexpected T_IF

The e

restricting another login once you logout
Hello,

how can I restrict a page from login authenticating against info in a MySQL DB for a s

listing help
Hi,

at first, great new design!!! I like it,

i got a problem,

I want to list so

PDO returns erroneous columns from within pdt
Hi All,

This is a truly weird behavior:
When using a simple pdo fetch, erroneous columns a

validating url
im trying to validate url's sent to me by a form
the url's im collecting are for placing banners

empty() error
Why does

Code: empty($USER_ID = $_SESSION["USER_ID"])
create this error...

printing links
Hi every1

i am connecting to a table in sql and the looping through with a while ($ var = my

getting weird error..
okay, I'm getting an error on this particular function, something about the syntax in the mysql LIMI

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash